Lockless uidinfo.

John Baldwin jhb at freebsd.org
Tue Aug 21 14:53:45 PDT 2007


On Tuesday 21 August 2007 05:12:00 pm Maciej Sobczak wrote:
> John Baldwin wrote:
> 
> > Memory barriers on another CPU don't mean anything about the CPU thread 2 
is 
> > on.
> 
> Of course they do. Otherwise they would be completely useless.

No.  If you invoke a membar on CPU 1, it does not affect "when" CPU 2 will see 
that write.  It does not post the write out immediately or such.  Some people 
get confused by that.  All a membar does is to order writes on CPU 1.  You 
can take advantage of that by using membar's on a lock cookie to guarantee 
CPU 2 will see writes done by CPU 1 when it acquires the lock, but just 
throwing a membar on an stand-alone atomic operation does not close any races 
or guarantee anything about when CPU 2 will see that write.

-- 
John Baldwin


More information about the freebsd-arch mailing list