Re: [PATCH v12 8/9] cpumask: Add initialiser CPUMASK_NULL to use cleanup helpers
From: Gabriele Monaco
Date: Wed Sep 17 2025 - 03:52:01 EST
On Tue, 2025-09-16 at 13:27 +0200, Frederic Weisbecker wrote:
> Le Mon, Sep 15, 2025 at 02:35:12PM -0400, Yury Norov a écrit :
> > On Mon, Sep 15, 2025 at 05:02:45PM +0000, Gabriele Monaco wrote:
> > > 2025-09-15T16:04:53Z Yury Norov <yury.norov@xxxxxxxxx>:
> > > > So why don't you pick the original patch instead?
> > >
> > > In my opinion, the /juice/ of that patch was included with [1],
> > > here I'm just adding part of it.
> > > If you prefer I can pick that patch and adapt the commit message
> > > to reflect only the part included here.
> > >
> > > [1] -
> > > https://lore.kernel.org/lkml/1706509267-17754-3-git-send-email-schakrabarti@xxxxxxxxxxxxxxxxxxx/
> >
> > Yes please.
Alright, will use your commit in v13 while changing the macro name to
CPUMASK_VAR_NULL as suggested.
> And can we rename CPUMASK_NULL to CPUMASK_VAR_NULL to avoid
> accidents/confusion with real
> cpumasks initializations?
Note that in the linked commit message, you have what I believe is an
incorrect assumption:
> So define a CPUMASK_VAR_NULL macro, ... and effectively a no-op
> when CPUMASK_OFFSTACK is disabled.
According to what I can understand from the standard, the C list
initialisation sets to the default value (e.g. 0) all elements not
present in the initialiser. Since in {} no element is present, {} is
not a no-op but it initialises the entire cpumask to 0.
Am I missing your original intent here?
It doesn't look like a big price to pay, but I'd still reword the
sentence to something like:
"and a valid struct initializer when CPUMASK_OFFSTACK is disabled."
Thanks,
Gabriele