David S. Miller writes:
That first cache line of current_thread_info() should be so hot that
it's probably just fine to use current_thread_info()->task since
you're just doing a mask on a fixed register (r1) to implement that.
I tried that, but I found that adding 1 instruction to the sequence
for getting current adds about 8k to the kernel text. Currently we do
it in one instruction, that would be two - the mask and the load. It
probably doesn't make a measurable difference to performance, but it
doesn't look good. The number of instructions we lose by using
__thread is much less than the 8k we gain from using
current_thread_info()->task for current. So I'd prefer to use a
per-cpu variable for current, since we can get to that in 1
instruction.
Paul.