On Tue, Aug 24, 2010 at 12:59:30PM +0100, Rui Paulo wrote:
> 
> On 24 Aug 2010, at 12:48, Kostik Belousov wrote:
> >> +#if defined(sun)
> >>    for (i = 0; i < NCPU; i++) {
> >>            mutex_enter(&cpu_core[i].cpuc_pid_lock);
> >>            mutex_exit(&cpu_core[i].cpuc_pid_lock);
> >>    }
> >> +#else
> >> +  /* XXX */
> >> +  __asm __volatile("": : :"memory");
> > Indeed XXX. Semantic of acquiring/releasing a mutex, even on Solaris,
> > is much stricter then performing compiler-level memory barrier.
> 
> I don't know what kind of mutexes we have in FreeBSD to mimc this behavior.

I believe that the usual sleepable mutex acquisition provides full barrier
both in Solaris and FreeBSD case. But, I also suspect that there is more
then just membar on current CPU. They use per-cpu mutexes, that is a known
technique to provide biased locking. See
http://blogs.sun.com/dave/resource/Asymmetric-Dekker-Synchronization.txt
for relatively long discussion.

Attachment: pgpgyZjytQp3v.pgp
Description: PGP signature

Reply via email to