Re: get_current is __pure__, maybe __const__ even

William Lee Irwin III
2004-09-16T03:23:12Z

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.

William Lee Irwin III wrote:
>> Not over a call to schedule(). In the midst of schedule().

On Thu, Sep 16, 2004 at 12:47:50PM +1000, Nick Piggin wrote:
> 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.

We have a clobber in inline asm and a manual barrier() so we don't need
to change anything if current were to be properly CSE'd. It's somewhat
academic; if current were (mis)used there, it would change.

-- wli