Re: get_current is __pure__, maybe __const__ even

Nick Piggin
2004-09-16T02:48:04Z

William Lee Irwin III wrote:

> On Wed, Sep 15, 2004 at 10:10:20PM -0400, Albert Cahalan wrote:
>
>>I don't think even barrier() is needed.
>>Suppose gcc were to cache the value of
>>current over a schedule. Who cares? It'll
>>be the same after schedule() as it was
>>before.
>
>
> Not over a call to schedule(). In the midst of schedule().
>

In a way, it is. Because after context_switch, the stack
and registers have been replaced by the new task. So if
current was cached somewhere before that task had scheduled
off, then it still would be correct now that it is scheduled
back on.

At points *within* context_switch, current won't be right,
but AFAIKS current is never used in there.