Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Aug 2007 17:43:18 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Maciej Sobczak <prog@msobczak.com>
Cc:        freebsd-arch@freebsd.org
Subject:   Re: Lockless uidinfo.
Message-ID:  <200708211743.19269.jhb@freebsd.org>
In-Reply-To: <46CB5520.4090505@msobczak.com>
References:  <20070818120056.GA6498@garage.freebsd.pl> <200708211403.29293.jhb@freebsd.org> <46CB5520.4090505@msobczak.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200708211743.19269.jhb>