Re: OOPS: 2.6.16-rc6 cpufreq_conservative

From: Linus Torvalds
Date: Sat Mar 18 2006 - 21:38:04 EST

On Sat, 18 Mar 2006, Andrew Morton wrote:
> Yes, uninlining merely first_cpu() shrinks my usual vmlinux by 2.5k. I'll
> fix it up.

The thing is, we could do _so_ much better if we just fixed the "calling
convention" for that loop.

In particular, if we instead of

for_each_cpu_mask(cpu, mask)
.. do something with cpu ..


for_each_cpu_mask(cpu, mask) {
.. do something with cpu ..
} end_for_each_online_cpu;

we could do

#define for_each_cpu_mask(cpu, mask) \
{ unsigned long __cpubits = (mask)->bits[0]; \
for (cpu = 0; __cpubits; cpu++, cpubits >>= 1) { \
if (!(__cpubits & 1)) \

#define end_for_each_cpu_mask } }

then the code we'd generate would be
(a) tons smaller
(b) lots faster
than what we do now. No uninlining necessary, because we'd simply not have
any complex code to either inline or to call.

The reason the code sucks right now is that the interface is bad, and
causes us to do insane things to make it work at all with that syntax.

(We already have this kind of thing for the "do_each_thread /
while_each_thread" interface to make it work sanely. Also, anybody who has
ever played with "sparse" has seen the wonderful and flexible
FOR_EACH_PTR() .. END_FOR_EACH_PTR() interface that allows for efficient
pointer list traversal).

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at