Re: [PATCH v1 1/1] sched/fair: Mark cfs_bandwidth_used() and m*_vruntime() with __maybe_unused

From: Valentin Schneider
Date: Tue Nov 12 2024 - 14:37:42 EST


On 12/11/24 17:18, Andy Shevchenko wrote:
> On Tue, Nov 12, 2024 at 12:48:42PM +0100, Valentin Schneider wrote:
>> On 05/09/24 20:12, Andy Shevchenko wrote:
>> > When cfs_bandwidth_used() is unused, it prevents kernel builds
>> > with clang, `make W=1` and CONFIG_WERROR=y:
>> >
>> > kernel/sched/fair.c:526:19: error: unused function 'max_vruntime' [-Werror,-Wunused-function]
>> > 526 | static inline u64 max_vruntime(u64 max_vruntime, u64 vruntime)
>> > | ^~~~~~~~~~~~
>> > kernel/sched/fair.c:6580:20: error: unused function 'cfs_bandwidth_used' [-Werror,-Wunused-function]
>> > 6580 | static inline bool cfs_bandwidth_used(void)
>> > | ^~~~~~~~~~~~~~~~~~
>> >
>> > Fix this by marking them with __maybe_unused (all cases for the sake of
>> > symmetry).
>> >
>>
>> I assume that's with CONFIG_CFS_BANDWIDTH=n? Looks like
>> cfs_bandwidth_used() uses are tucked away under helpers that themselves
>> only really do something for CONFIG_CFS_BANDWIDTH=y, so you could remove
>> the CONFIG_CFS_BANDWIDTH=n definition of cfs_bandwidth_used() directly.
>
> Thanks for looking into this!
>
>> This compiles:
>
> okay, consider then my patch as a report. Can you submit your version as you
> seems much more familiar with this code than me?

Sure, I'll add this to my todolist.