Re: [PATCH v1] sched/topology: Make compiler happy about unused constant definitions
From: Valentin Schneider
Date: Tue Aug 25 2020 - 05:03:25 EST
On 25/08/20 09:26, Andy Shevchenko wrote:
> On Mon, Aug 24, 2020 at 06:09:41PM +0100, Valentin Schneider wrote:
>> On 24/08/20 16:39, Andy Shevchenko wrote:
>> > Compilation of almost each file ends up with
>> >
>> > In file included from .../include/linux/energy_model.h:10,
>> > from .../include/linux/device.h:16,
>> > from .../drivers/spi/spi.c:8:
>> > .../include/linux/sched/topology.h:30:27: warning: ‘SD_DEGENERATE_GROUPS_MASK’ defined but not used [-Wunused-const-variable=]
>> > 30 | static const unsigned int SD_DEGENERATE_GROUPS_MASK =
>> > | ^~~~~~~~~~~~~~~~~~~~~~~~~
>> > ...
>> >
>> > Make compiler happy by annotating the static constants with __maybwe_unused.
>> >
>>
>> That should see some use as long as the build is for SMP. This whole region
>> is guarded by #ifdef CONFIG_SMP, so an !SMP build shouldn't trigger this.
>
> Isn't SMP is default for most of the kernel builds?
> And honestly I didn't get the purpose of this comment.
>
Sorry, that's what I get for trying to be too succinct; what I tried to say
was that SD_DEGENERATE_GROUPS_MASK should very much be used for SMP. If the
build is !SMP, it shouldn't even be defined, IOW I'm perplexed as to where
this is coming from.
>> With what config/kernel are you getting this?
>
> x86_64_defconfig from the kernel sources with some drivers added (SMP or so has
> not been touched, DEBUG_SHED was enabled once to confirm that another static
> const has same issue).
Thanks, I'll poke around this.