Re: get_current is __pure__, maybe __const__ even

Russell King
2004-09-16T14:40:10Z

On Thu, Sep 16, 2004 at 01:03:55PM +0200, Andi Kleen wrote:
> > The scheduler quite rightly expects, for any thread, that any variable
> > which may be stored in a CPU register before the context switch has the
> > same value as after the context switch.
>
> Just current isn't a varible, it's some inline assembly in a inline
> function. The question was if that function could be marked const/pure.

Sigh. What does that matter?

current_thread, which is what we should be talking about here, is
indeed a function, but its returned value depends wholely on the
stack pointer value.

Since the stack pointer and thread info are invariably coupled
together, it is right to mark it const/pure.

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/
2.6 Serial core