From owner-cvs-all Mon Jan 15 23: 8:55 2001 Delivered-To: cvs-all@freebsd.org Received: from moby.geekhouse.net (moby.geekhouse.net [64.81.6.36]) by hub.freebsd.org (Postfix) with ESMTP id 3B2F437B401; Mon, 15 Jan 2001 23:08:24 -0800 (PST) Received: from laptop.baldwin.cx (john@dhcp150.geekhouse.net [192.168.1.150]) by moby.geekhouse.net (8.11.0/8.9.3) with ESMTP id f0G7Bts53081; Mon, 15 Jan 2001 23:11:55 -0800 (PST) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <200101160615.f0G6FsI31623@gratis.grondar.za> Date: Mon, 15 Jan 2001 23:08:14 -0800 (PST) From: John Baldwin To: Mark Murray Subject: Re: cvs commit: src/sys/i386/include atomic.h Cc: cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org, jake@FreeBSD.org Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 -- 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