Re: [PATCH v2] sched: rcu: fix rq->{curr,donor} address space annotations
From: Peter Zijlstra
Date: Fri Feb 20 2026 - 14:48:52 EST
On Sat, Feb 21, 2026 at 03:33:53AM +0800, Sun Jian wrote:
> With CONFIG_SCHED_PROXY_EXEC enabled, struct rq::curr and rq::donor are
> annotated as __rcu. Several call sites access these pointers as plain
> struct task_struct * while holding rq locks, which triggers address
> space warnings from sparse.
>
> Fix these sites by dereferencing rq->{curr,donor} with
> rcu_dereference_protected() under rq locks and reusing local pointers,
> and by using rcu_access_pointer() for address-only comparisons.
>
> No functional change intended.
>
> Build/verify:
> make -j$(nproc) O=../out/full-clang-x86_64 LLVM=1 kernel/sched/core.o
> make -j$(nproc) O=../out/full-clang-x86_64 LLVM=1 C=2 CHECK=sparse \
> kernel/sched/{core,pelt,build_policy}.o
>
> Signed-off-by: Sun Jian <sun.jian.kdev@xxxxxxxxx>
Yeah, lets not do this. It makes the code horrible.