Re: ordered memory access

Andrea Arcangeli (andrea@suse.de)
Thu, 30 Sep 1999 23:50:21 +0200 (CEST)


On Thu, 30 Sep 1999, Horst von Brand wrote:

>What if you intend to use something like:
>
>
> atomic_inc(lock);
> /* Do something */
>
>and the /* Do something */ is moved _before_ the atomic_inc(lock)? For this
>to be of any use in this way, you'd need the atomic_inc() and its ilk to
>act as barriers. So it depends on the use to which they are put (or are
>intended to be put).

You'll simply have to add a mb() after the atomic_inc() by hand if you'll
want to enforce ordering.

Usually if you don't test any condition then it means you'll be allowed to
always go into the critical section and so you don't need a lock in first
place.

Andrea

-
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/