Re: [PATCH 1/3] sched: idle: Encapsulate the code to compile it out

From: Nicolas Pitre
Date: Wed Apr 30 2014 - 13:39:38 EST


On Thu, 24 Apr 2014, Daniel Lezcano wrote:

> Encapsulate the large portion of cpuidle_idle_call inside another
> function so when CONFIG_CPU_IDLE=n, the code will be compiled out.
> Also that is benefitial for the clarity of the code as it removes
> a nested indentation level.

I agree with the nesting level concern.

However I dislike the proliferation of #ifdef's in the main code. Those
added in this patch are unnecessary. We want as much compilation
coverage as possible.

With cpuidle_enabled() already hardcoded to return -ENODEV when
CONFIG_CPU_IDLE=n, the compiler should already be smart enough to
optimize away all the redundant code in that case. You may look at the
assembly output from the compiler if you're not sure.

And if you're still not trusting the compiler then the second best
option is to use IS_ENABLED(CONFIG_CPU_IDLE) inside some if statement.


Nicolas
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/