From: Yury Norov <ynorov@nvidia.com>
To: Valentin Schneider <vschneid@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
linux-kernel@vger.kernel.org, Yury Norov <yury.norov@gmail.com>
Subject: Re: [PATCH] sched/topology: optimize sched_numa_find_nth_cpu()
Date: Wed, 1 Apr 2026 10:54:22 -0400 [thread overview]
Message-ID: <ac0xezTAb5oyVci-@yury> (raw)
In-Reply-To: <xhsmhjyurf0un.mognet@vschneid-thinkpadt14sgen2i.remote.csb>
On Wed, Apr 01, 2026 at 12:09:52PM +0200, Valentin Schneider wrote:
> On 28/03/26 17:42, Yury Norov wrote:
> > Please no kernel doc syntax out of kernel doc blocks.
> >
>
> Why not? It's straight to the point and not uncommon in sched code.
Because it's weird to see machine-readable marks in a text for human.
In that particular file, I see it in:
- NUMA topology huge comment block for 'level' of hops, which is not
even a variable, so misleading;
- in annotation to sched_numa_find_closest() - should be converted to
kernel doc and fixed; and
- in an inline comment in build_sched_domain:
/* Fixup, ensure @sd has at least @child CPUs. */
So, a single more or less matching case in a 3k LOCs file.
I'll send a patch.
> >> hop = hop_masks - k.masks;
> >>
> >> + /*
> >> + * @hop is constructed by hop_cmp() such that sched_domains_numa_masks[hop][node]
> >
> > hop_cmp() doesn't construct, it's a comparator for bsearch, which searches for
> > the nearest hop containing at least N CPUs.
> >
> >> + * spans enough CPUs to return an @nth_cpu, and sched_domains_numa_masks[hop-1][node]
> >> + * doesn't.
> >> + *
> >> + * Get a cpumask without the CPUs from sched_domains_numa_masks[hop-1][node]
> >> + * subtract how many CPUs that contains (@k.w), and fetch our @nth_cpu from
> >> + * the resulting mask.
> >
> > It explains only hop != NULL case. This sentence confuses more than
> > explain, to me. The below code is quite self-explaining.
> >
>
> My goal was to allow the reader to have a gist of how @hop_masks and @k are
> arranged upon returning from bsearch() without having to dig down to how
> bsearch()+hop_cmp() will interact.
>
> Right now nothing tells you what @k.w is unless you go dig for it.
hop_masks is the bsearch output, so pretty straightforward to me. If
you think it's vague, maybe just pick a better name?
The k.w should be explained in struct __cmp_key description. And just
in case, it's an output field containing the number of CPUs in a given
hop, matching the user-provided 'cpus' mask.
> >> + */
> >> ret = hop ?
> >> cpumask_nth_and_andnot(cpu - k.w, cpus, k.masks[hop][node], k.masks[hop-1][node]) :
> >> cpumask_nth_and(cpu, cpus, k.masks[0][node]);
prev parent reply other threads:[~2026-04-01 14:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-19 17:26 Yury Norov
2026-03-26 19:05 ` Valentin Schneider
2026-03-26 19:09 ` Valentin Schneider
2026-03-26 19:45 ` Valentin Schneider
2026-03-27 13:38 ` Shrikanth Hegde
2026-03-27 15:59 ` Valentin Schneider
2026-03-28 21:42 ` Yury Norov
2026-04-01 10:09 ` Valentin Schneider
2026-04-01 14:54 ` Yury Norov [this message]
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=ac0xezTAb5oyVci-@yury \
--to=ynorov@nvidia.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=yury.norov@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
Powered by JetHome