From: Peter Zijlstra <peterz@infradead.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: x86@kernel.org, tglx@kernel.org, linux-kernel@vger.kernel.org,
tim.c.chen@linux.intel.com, yu.c.chen@intel.com,
kyle.meyer@hpe.com, vinicius.gomes@intel.com, brgerst@gmail.com,
hpa@zytor.com, kprateek.nayak@amd.com,
patryk.wlazlyn@linux.intel.com, rafael.j.wysocki@intel.com,
russ.anderson@hpe.com, zhao1.liu@intel.com, tony.luck@intel.com,
Zhang Rui <rui.zhang@intel.com>
Subject: Re: [PATCH v2 4/5] x86/topo: Fix SNC topology mess
Date: Tue, 3 Mar 2026 15:45:58 +0100 [thread overview]
Message-ID: <20260303144558.GC3698720@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <aabNMle4iUDt-elY@gmail.com>
On Tue, Mar 03, 2026 at 12:59:46PM +0100, Ingo Molnar wrote:
>
> * Peter Zijlstra <peterz@infradead.org> wrote:
>
> > +static u32 slit_cluster_package(int N)
> > +{
> > + int u = topology_num_nodes_per_package();
> > + u32 pkg_id = ~0;
> > +
> > + for (int n = 0; n < u; n++) {
> > + const struct cpumask *cpus = cpumask_of_node(N + n);
> > + int cpu;
> > +
> > + for_each_cpu(cpu, cpus) {
> > + u32 id = topology_logical_package_id(cpu);
> > + if (pkg_id == ~0)
> > + pkg_id = id;
>
> Nit: newline after the 'id' local variable definition.
>
> > + /*
> > + * Off-trace cluster.
> > + *
> > + * Notably average out the symmetric pair of off-trace clusters to
> > + * ensure the resulting SLIT table is symmetric.
> > + */
> > + x = i - (i % u);
> > + y = j - (j % u);
>
> AFAICS that's an open-coded rounddown() from <linux/math.h>:
>
> x = rounddown(i, u);
> y = rounddown(j, u);
>
> right?
Yeah, but I can never remember those 'helpers'. That is, if I have to
spend time looking for them, they're a net negative to me.
Same reason I'm most likely to write: (x + d - 1) / d, rather than,
uhmmm, /me goes find.. DIV_ROUND_UP(). And while I did actually use
that in this series, that's only because it was already in use at the
exact spot I made a change, so I didn't have to go looking.
So sure, I can do the rounddown() thing, but really, its longer than the
thing they replace and less clear, so where's the win?
next prev parent reply other threads:[~2026-03-03 14:46 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-03 10:55 [PATCH v2 0/5] x86/topo: SNC Divination Peter Zijlstra
2026-03-03 10:55 ` [PATCH v2 1/5] x86/numa: Store extra copy of numa_nodes_parsed Peter Zijlstra
2026-03-04 15:46 ` [tip: x86/urgent] " tip-bot2 for Peter Zijlstra
2026-03-03 10:55 ` [PATCH v2 2/5] x86/topo: Add topology_num_nodes_per_package() Peter Zijlstra
2026-03-04 15:46 ` [tip: x86/urgent] " tip-bot2 for Peter Zijlstra
2026-03-03 10:55 ` [PATCH v2 3/5] x86/topo: Replace x86_has_numa_in_package Peter Zijlstra
2026-03-04 15:46 ` [tip: x86/urgent] " tip-bot2 for Peter Zijlstra
2026-03-03 10:55 ` [PATCH v2 4/5] x86/topo: Fix SNC topology mess Peter Zijlstra
2026-03-03 11:59 ` Ingo Molnar
2026-03-03 14:45 ` Peter Zijlstra [this message]
2026-03-04 15:46 ` [tip: x86/urgent] " tip-bot2 for Peter Zijlstra
2026-03-03 10:55 ` [PATCH v2 5/5] x86/resctrl: Fix SNC detection Peter Zijlstra
2026-03-04 15:46 ` [tip: x86/urgent] " tip-bot2 for Tony Luck
2026-04-28 20:41 ` Babu Moger
2026-04-28 20:52 ` Luck, Tony
2026-04-28 23:09 ` Moger, Babu
2026-03-03 12:01 ` [PATCH v2 0/5] x86/topo: SNC Divination Ingo Molnar
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=20260303144558.GC3698720@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=brgerst@gmail.com \
--cc=hpa@zytor.com \
--cc=kprateek.nayak@amd.com \
--cc=kyle.meyer@hpe.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=patryk.wlazlyn@linux.intel.com \
--cc=rafael.j.wysocki@intel.com \
--cc=rui.zhang@intel.com \
--cc=russ.anderson@hpe.com \
--cc=tglx@kernel.org \
--cc=tim.c.chen@linux.intel.com \
--cc=tony.luck@intel.com \
--cc=vinicius.gomes@intel.com \
--cc=x86@kernel.org \
--cc=yu.c.chen@intel.com \
--cc=zhao1.liu@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.