Messages in this thread | | | Date | Sat, 18 Mar 2006 18:38:28 -0800 (PST) | From | Linus Torvalds <> | Subject | Re: OOPS: 2.6.16-rc6 cpufreq_conservative |
| |
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 ..
had
for_each_cpu_mask(cpu, mask) { .. do something with cpu .. } end_for_each_online_cpu;
we could do
#if NR_CPUS <= BITS_IN_LONG #define for_each_cpu_mask(cpu, mask) \ { unsigned long __cpubits = (mask)->bits[0]; \ for (cpu = 0; __cpubits; cpu++, cpubits >>= 1) { \ if (!(__cpubits & 1)) \ continue;
#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).
Linus - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |