Re: set_current_state

Jamie Lokier (lkd@tantalophile.demon.co.uk)
Mon, 6 Sep 1999 19:03:47 +0200


Andrea Arcangeli wrote:
> >AFAIK the ordering of volatile operations is only defined with respect
> >to each other.
>
> I thought the rule was different.

I'm not absolutely sure. I read once that `volatile' accesses and I/O
function calls are the visible side-effects of a C program, which must
be preserved, and the compiler is free to optimise the rest as it
likes. I think it's a C standard issue.

> If that is true we should add a
> barrier() after setting current->state in the UP code. Are you 100% sure
> that the compiler can move not-volatile data read/write across the write
> of a volatile var?

Look on the bright side. If you're right, a UP barrier won't change the
code anyway as it's only an instruction ordering barrier, not bus level :-)

-- Jamie

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/