From: Sander Vanheule <sander@svanheule.net>
To: Yury Norov <yury.norov@gmail.com>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
elver@google.com, gregkh@linuxfoundation.org,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
vschneid@redhat.com, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
"H . Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH v4 4/5] cpumask: Add UP optimised for_each_*_cpu versions
Date: Sun, 03 Jul 2022 09:37:25 +0200 [thread overview]
Message-ID: <c8285910dfb7f8fe47e978f542ba6cf39b3df619.camel@svanheule.net> (raw)
In-Reply-To: <YsC9pH54rpr/lriv@yury-laptop>
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@svanheule.net>
> >
> > Acked-by: Yury Norov <yury.norov@gmail.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
next prev parent reply other threads:[~2022-07-03 7:37 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-02 16:08 [PATCH v4 0/5] cpumask: Fix invalid uniprocessor assumptions Sander Vanheule
2022-07-02 16:08 ` [PATCH v4 1/5] x86/cacheinfo: move shared cache map definitions Sander Vanheule
2022-07-02 16:08 ` [PATCH v4 2/5] cpumask: Fix invalid uniprocessor mask assumption Sander Vanheule
2022-07-02 21:42 ` Yury Norov
2022-07-03 14:17 ` Sander Vanheule
2022-07-02 16:08 ` [PATCH v4 3/5] lib/test: Introduce cpumask KUnit test suite Sander Vanheule
2022-07-02 21:45 ` Yury Norov
2022-07-03 7:26 ` Sander Vanheule
2022-07-19 21:31 ` Maíra Canal
2022-07-20 5:24 ` David Gow
2022-07-20 12:43 ` Sander Vanheule
2022-07-20 12:47 ` Sander Vanheule
2022-07-02 16:08 ` [PATCH v4 4/5] cpumask: Add UP optimised for_each_*_cpu versions Sander Vanheule
2022-07-02 21:47 ` Yury Norov
2022-07-02 21:50 ` Yury Norov
2022-07-03 7:37 ` Sander Vanheule [this message]
2022-07-02 16:08 ` [PATCH v4 5/5] cpumask: Update cpumask_next_wrap() signature Sander Vanheule
2022-07-02 20:38 ` [PATCH v4 0/5] cpumask: Fix invalid uniprocessor assumptions Andrew Morton
2022-07-03 7:50 ` Sander Vanheule
2022-07-03 20:39 ` Andrew Morton
2022-07-10 6:51 ` Sander Vanheule
2022-07-11 20:22 ` Andrew Morton
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=c8285910dfb7f8fe47e978f542ba6cf39b3df619.camel@svanheule.net \
--to=sander@svanheule.net \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=elver@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=vschneid@redhat.com \
--cc=x86@kernel.org \
--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
all inboxes | Powered by JetHome®