From mboxrd@z Thu Jan 1 00:00:00 1970 From: peterz@infradead.org (Peter Zijlstra) Date: Fri, 20 Apr 2018 18:51:39 +0200 Subject: [PATCH] sched/fair: Change sched_feat(x) in !CONFIG_SCHED_DEBUG case In-Reply-To: <34572fee-36d0-36e1-ba6d-f098b145aba4@gmx.de> References: <20180416085426.24157-1-Phil_K97@gmx.de> <20180420075717.GB4064@hirez.programming.kicks-ass.net> <34572fee-36d0-36e1-ba6d-f098b145aba4@gmx.de> Message-ID: <20180420165139.GP4064@hirez.programming.kicks-ass.net> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org 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.