[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZYnD4Bp8R9oIz19s@yury-ThinkPad>
Date: Mon, 25 Dec 2023 10:03:12 -0800
From: Yury Norov <yury.norov@...il.com>
To: Ming Lei <ming.lei@...hat.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>, linux-kernel@...r.kernel.org,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>
Subject: Re: [PATCH v3 7/7] lib/group_cpus: simplify grp_spread_init_one()
for more
On Wed, Dec 13, 2023 at 09:06:12AM +0800, Ming Lei wrote:
> On Mon, Dec 11, 2023 at 08:21:07PM -0800, Yury Norov wrote:
> > The outer and inner loops of grp_spread_init_one() do the same thing -
> > move a bit from nmsk to irqmsk.
> >
> > The inner loop iterates the sibling group, which includes the CPU picked
> > by outer loop. And it means that we can drop the part that moves the bit
> > in the outer loop.
> >
> > Signed-off-by: Yury Norov <yury.norov@...il.com>
> > ---
> > lib/group_cpus.c | 8 +-------
> > 1 file changed, 1 insertion(+), 7 deletions(-)
> >
> > diff --git a/lib/group_cpus.c b/lib/group_cpus.c
> > index 664a56171a1b..7aa7a6289355 100644
> > --- a/lib/group_cpus.c
> > +++ b/lib/group_cpus.c
> > @@ -18,14 +18,8 @@ static void grp_spread_init_one(struct cpumask *irqmsk, struct cpumask *nmsk,
> > int cpu, sibl;
> >
> > for_each_cpu(cpu, nmsk) {
> > - __cpumask_clear_cpu(cpu, nmsk);
> > - __cpumask_set_cpu(cpu, irqmsk);
> > - if (cpus_per_grp-- == 0)
> > - return;
> > -
> > - /* If the cpu has siblings, use them first */
> > siblmsk = topology_sibling_cpumask(cpu);
> > - sibl = cpu + 1;
> > + sibl = cpu;
> >
> > for_each_cpu_and_from(sibl, siblmsk, nmsk) {
> > __cpumask_clear_cpu(sibl, nmsk);
>
> Correctness of the above change requires that 'cpu' has to be included
> into topology_sibling_cpumask(cpu), however, not sure it is always true,
> see the following comment in Documentation/arch/x86/topology.rst
>
> `
> - topology_sibling_cpumask():
>
> The cpumask contains all online threads in the core to which a thread
> belongs.
> `
It's kind of nontrivial to spread IRQs on offline CPUs, but
technically the above seems correct. I'll drop the patch then.
Powered by blists - more mailing lists