tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: 4.x -> 5.x locking?



On Wed, Nov 09, 2011 at 09:37:47AM -0500, Mouse wrote:
> >>    membar_sync();
> >>    mutex_exit(mtx);
> > mutex_enter and mutex_exit are implicit memory barriers (reads and
> > writes respectively are not allowed to be reordered).
> 
> Oh!  Thank you.  Has that made it into mutex(9) in -current?  If not, I
> offer my opinion that it should.
> 
> Does mutex_exit also implicitly push writes to main RAM, or whatever
> else is necessary to make them visible to other CPUs?  (A reordering
> barrier does not necessarily imply a global visibility barrier.)

I don't think it guarantees it by itself. That is, if you want to access
the data on a different CPU, you either need to take the mutex (and the
read barrier in mutex_enter) or issue an explicit barrier.

Joerg


Home | Main Index | Thread Index | Old Index