[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.0610132216290.22133-100000@netrider.rowland.org>
Date: Fri, 13 Oct 2006 22:27:36 -0400 (EDT)
From: Alan Stern <stern@...land.harvard.edu>
To: "Paul E. McKenney" <paulmck@...ibm.com>
cc: David Howells <dhowells@...hat.com>,
Kernel development list <linux-kernel@...r.kernel.org>
Subject: Re: Uses for memory barriers
On Fri, 13 Oct 2006, Paul E. McKenney wrote:
> Ewww... How about __kfifo_get() and __kfifo_put()? These have no atomic
> operations. Ah, but they are restricted to pairs of tasks, so pairwise
> memory barriers should suffice.
Tasks can migrate from one CPU to another, of course. But that involves
context switching and plenty of synchronization operations in the kernel,
so you're okay in that respect.
> For the pairwise memory barriers, I really like "conditionally precedes",
> which makes it very clear that the observation of order is not automatic.
> On both CPUs, and explicit memory barrier is required (with the exception
> of MMIO, where the communication is instead with an I/O device).
>
> For the single-variable case and for the single-CPU case, just plain
> "precedes" works, at least as long as you are not doing fine-grained
> timings that can allow you to observe cache lines in motion. But if
> you are doing that, you had better know what you are doing anyway. ;-)
The reason I don't like "conditionally precedes" is because it suggests
the ordering is not automatic even in the single-CPU case.
Alan
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists