[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c8285910dfb7f8fe47e978f542ba6cf39b3df619.camel@svanheule.net>
Date: Sun, 03 Jul 2022 09:37:25 +0200
From: Sander Vanheule <sander@...nheule.net>
To: Yury Norov <yury.norov@...il.com>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
elver@...gle.com, gregkh@...uxfoundation.org,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>, vschneid@...hat.com,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H . Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH v4 4/5] cpumask: Add UP optimised for_each_*_cpu versions
On Sat, 2022-07-02 at 14:50 -0700, Yury Norov wrote:
> On Sat, Jul 02, 2022 at 02:47:55PM -0700, Yury Norov wrote:
> > On Sat, Jul 02, 2022 at 06:08:27PM +0200, Sander Vanheule wrote:
> > > On uniprocessor builds, the following loops will always run over a mask
> > > that contains one enabled CPU (cpu0):
> > > - for_each_possible_cpu
> > > - for_each_online_cpu
> > > - for_each_present_cpu
> > >
> > > Provide uniprocessor-specific macros for these loops, that always run
> > > exactly once.
> > >
> > > Signed-off-by: Sander Vanheule <sander@...nheule.net>
> >
> > Acked-by: Yury Norov <yury.norov@...il.com>
>
> I think this patch should go before #2 to avoid possible issues while
> bisecting...
The old assumption was valid in this case, but I agree it makes sense to move this patch forward in
the series. Also to avoid a cycle of optimised/generic/optimised, even if the behaviour doesn't
change.
Best,
Sander
> >
> > > ---
> > > include/linux/cpumask.h | 7 +++++++
> > > 1 file changed, 7 insertions(+)
> > >
> > > diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
> > > index 7fbef41b3093..6c5b4ee000f2 100644
> > > --- a/include/linux/cpumask.h
> > > +++ b/include/linux/cpumask.h
> > > @@ -750,9 +750,16 @@ extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS);
> > > /* First bits of cpu_bit_bitmap are in fact unset. */
> > > #define cpu_none_mask to_cpumask(cpu_bit_bitmap[0])
> > >
> > > +#if NR_CPUS == 1
> > > +/* Uniprocessor: the possible/online/present masks are always "1" */
> > > +#define for_each_possible_cpu(cpu) for ((cpu) = 0; (cpu) < 1; (cpu)++)
> > > +#define for_each_online_cpu(cpu) for ((cpu) = 0; (cpu) < 1; (cpu)++)
> > > +#define for_each_present_cpu(cpu) for ((cpu) = 0; (cpu) < 1; (cpu)++)
> > > +#else
> > > #define for_each_possible_cpu(cpu) for_each_cpu((cpu), cpu_possible_mask)
> > > #define for_each_online_cpu(cpu) for_each_cpu((cpu), cpu_online_mask)
> > > #define for_each_present_cpu(cpu) for_each_cpu((cpu), cpu_present_mask)
> > > +#endif
> > >
> > > /* Wrappers for arch boot code to manipulate normally-constant masks */
> > > void init_cpu_present(const struct cpumask *src);
> > > --
> > > 2.36.1
Powered by blists - more mailing lists