[PATCH] sched/fair: Change sched_feat(x) in !CONFIG_SCHED_DEBUG case
Peter Zijlstra
peterz at infradead.org
Fri Apr 20 12:51:39 EDT 2018
On Fri, Apr 20, 2018 at 06:29:07PM +0200, Philipp Klocke wrote:
> The gain is stopping a warning that clutters the output log of clang.
Well, you should not be using clang anyway. It is known to miscompile
the kernel.
> To improve readability, one can drop the ifdef-structure and just keep
> the right shift version, like Nicholas suggested. This will have a (very
> small)
> impact on performance in CONFIG_SCHED_DEBUG case, but when
> debugging, performance is no problem anyways.
See that is two bad choices.
> > Also, if sysctl_sched_features is a constant, the both expressions
> > _should_ really result in a constant and clang should still warn about
> > it.
> No, because clang only warns if the constant is neither 1 nor 0.
> (These being the 'best' integer representations of booleans)
Then won't something like so work?
#define sched_feat(x) !!(sysctl_sched_features & (1UL << __SCHED_FEAT_##x))
That forces it into _Bool space (0/1) and per the above rule will no
longer warn.
More information about the Kernelnewbies
mailing list