[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e4035ff8-729e-4fc7-b40a-0775dada8811@redhat.com>
Date: Mon, 22 Sep 2025 10:07:54 +0000 (UTC)
From: Gabriele Monaco <gmonaco@...hat.com>
To: Yury Norov <yury.norov@...il.com>
Cc: linux-kernel@...r.kernel.org, Frederic Weisbecker <frederic@...nel.org>
Subject: Re: [PATCH v12 8/9] cpumask: Add initialiser CPUMASK_NULL to use
cleanup helpers
2025-09-19T14:58:18Z Yury Norov <yury.norov@...il.com>:
>> When you create a non-initialized variable on stack, compiler does
>> nothing about it, except for adjusting an argument to brk() emitted in
>> the function prologue.
>>
>> In this case, non-initialized struct cpumask is already on stack, and
>> switching from
>>
>> struct cpumask mask[1];
>>
>> to
>>
>> struct cpumask mask[1] = {};
>>
>> is really a no-op.
>
> Alright... The above is correct for optimization levels > 0.
> With -O0, 2nd version really makes GCC to initialize the array.
>
> https://godbolt.org/z/e1zG4K7M8
>
> This is not relevant for the kernel because -O2 is our default
> optimization level (I'm not even sure that -O0 is buildable).
> But you may want to mention that in commit message.
Thanks for testing that!
Makes totally sense. Although if it's something really unreachable in the kernel it may not make too much sense to mention in the commit message.
Also I'm not planning on sending another version after V13 [1], so we may let it slide.
Thanks,
Gabriele
[1] - https://lore.kernel.org/lkml/20250917161958.178925-1-gmonaco@redhat.com
Powered by blists - more mailing lists