Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jan 2001 23:08:14 -0800 (PST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Mark Murray <mark@grondar.za>
Cc:        cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org, jake@FreeBSD.org
Subject:   Re: cvs commit: src/sys/i386/include atomic.h
Message-ID:  <XFMail.010115230814.jhb@FreeBSD.org>
In-Reply-To: <200101160615.f0G6FsI31623@gratis.grondar.za>

next in thread | previous in thread | raw e-mail | index | archive | help

On 16-Jan-01 Mark Murray wrote:
>> > This has really helped my SMP stability here locally.  The quad xeon has
>> > now
>> > built 4 releases back to back w/o any problems.  It never made it through
>> > 2
>> > without locking up before.
>> 
>> Well, I've tried to stress test all my SMP test machines today.  No lockups
>> so
>> far.  The quad xeon did have a problem with a -j 1024 world though (make got
>> a
>> bus error).  No console messages though so not sure what that was about.  My
>> dual p3-600 had been locking up really bad this past week, but it has had 0
>> problems today with this fix.  If other people with SMP can test -current as
>> of
>> this patch and report any lockups, that would be helpful.
> 
> Cool! :-)
> 
> The other day, we were talking about the random_harvest stuff on IRC,
> and Jake said that he wanted the harvesting to be less expensive. One of the
> things Jake wanted was the mutexes removed. Are mutexes really that
> expensive,
> particularly if I just do a
> 
> if (mutex_try_enter(foo, ...)) {
>       /* Harvest */
>       :
>       mutex_exit(foo, ...);
> }
> 
> How much of a difference would it make if I were to use atomic ops like
> 
> if (atomic_cmpset(foo, 0, 1)) {
>       /* harvest */
>       :
>       foo = 0;
> }

You would have to use atomic_store_rel() here.  And you would have to use
atomic_cmpset_acq() since you are protecting something.

> ??

Since you are doing atomic operations with memory barriers either way, I'm not
sure that the mutex is that much slower, to be perfectly honest.

-- 

John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.baldwin.cx/~john/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




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