From: Peter Zijlstra <peterz@infradead.org>
To: Aaron Tomlin <atomlin@atomlin.com>
Cc: mingo@redhat.com, juri.lelli@redhat.com,
vincent.guittot@linaro.org, paulmck@kernel.org,
dietmar.eggemann@arm.com, rostedt@goodmis.org,
bsegall@google.com, mgorman@suse.de, vschneid@redhat.com,
kprateek.nayak@amd.com, zhanxusheng1024@gmail.com,
neelx@suse.com, chjohnst@mail.com, mproche@mail.com,
sean@ashe.io, steve@abita.co, rishil1999@outlook.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 1/6] sched: Annotate rq->rd with __rcu and update lockless readers
Date: Thu, 27 Aug 2026 12:50:21 +0200 [thread overview]
Message-ID: <20260827105021.GJ687043@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <jqzcreyz53zu4afr4g47ej5t3fc6cedpgdvj6whprn22e5lcwp@3f4tstxzfoqj>
On Thu, Aug 27, 2026 at 05:53:58AM -0400, Aaron Tomlin wrote:
> On Thu, Aug 27, 2026 at 11:39:35AM +0200, Peter Zijlstra wrote:
> > On Thu, Aug 27, 2026 at 05:35:44AM -0400, Aaron Tomlin wrote:
> >
> > > To solve this cleanly, I propose introducing a concise helper, for the root
> > > domain in kernel/sched/sched.h mirroring rcu_dereference_sched_domain(p):
> > >
> > > #define rcu_dereference_root_domain(p) \
> > > rcu_dereference_all_check((p), lockdep_is_held(&sched_domains_mutex))
> > >
> > > This covers both the update side (under sched_domains_mutex) and read-side
> > > contexts (under rq_lock(), preemption-disabled, or RCU read locks) via
> > > rcu_read_lock_any_held(), while keeping the call sites clean and
> > > eliminating Sparse warnings.
> > >
> > > Would you prefer rcu_dereference_root_domain(p)?
> >
> > Yeah, but I'm not sure I see the point of adding it, as it is exactly
> > the same as rcu_dereference_sched_domain(). The root domains are part of
> > the sched domains, so it doesn't seem wrong to me to use that existing
> > one.
>
> Indeed. However, the motivation is purely code clarity. Defining
> rcu_dereference_root_domain() preserves the natural symmetry of rq->rd and
> rq->sd in struct rq, while keeping grep-ability straightforward.
>
> That said, should you still prefer reusing rcu_dereference_sched_domain(),
> I am quite happy to convert them over.
*shrug*, either will do I suppose. You can create an alias if you think
it helps.
next prev parent reply other threads:[~2026-08-27 10:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 22:42 [PATCH v7 0/6] Introduce per-CPU debugfs files Aaron Tomlin
2026-08-26 22:42 ` [PATCH v7 1/6] sched: Annotate rq->rd with __rcu and update lockless readers Aaron Tomlin
2026-08-27 6:54 ` Vincent Guittot
2026-08-27 8:57 ` Aaron Tomlin
2026-08-27 7:30 ` Peter Zijlstra
2026-08-27 9:35 ` Aaron Tomlin
2026-08-27 9:39 ` Peter Zijlstra
2026-08-27 9:53 ` Aaron Tomlin
2026-08-27 10:50 ` Peter Zijlstra [this message]
2026-08-26 22:42 ` [PATCH v7 2/6] sched/debug: Protect lockless rq->rd access in print_dl_rq() Aaron Tomlin
2026-08-26 22:42 ` [PATCH v7 3/6] sched/debug: Protect lockless rq->curr access in print_cpu() Aaron Tomlin
2026-08-26 22:42 ` [PATCH v7 4/6] sched/debug: Protect p->mm access in sched_show_numa() Aaron Tomlin
2026-08-26 22:42 ` [PATCH v7 5/6] sched/fair: Use list_for_each_entry_rcu() in print_cfs_stats() Aaron Tomlin
2026-08-26 22:42 ` [PATCH v7 6/6] sched/debug: Introduce per-CPU debugfs files Aaron Tomlin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260827105021.GJ687043@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=atomlin@atomlin.com \
--cc=bsegall@google.com \
--cc=chjohnst@mail.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=mproche@mail.com \
--cc=neelx@suse.com \
--cc=paulmck@kernel.org \
--cc=rishil1999@outlook.com \
--cc=rostedt@goodmis.org \
--cc=sean@ashe.io \
--cc=steve@abita.co \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=zhanxusheng1024@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®