From owner-freebsd-arch@FreeBSD.ORG Fri Aug 24 14:10:38 2007 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E25F716A417; Fri, 24 Aug 2007 14:10:38 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (arm132.internetdsl.tpnet.pl [83.17.198.132]) by mx1.freebsd.org (Postfix) with ESMTP id 36CF713C442; Fri, 24 Aug 2007 14:10:38 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id D5CC54880A; Fri, 24 Aug 2007 16:10:36 +0200 (CEST) Received: from localhost (pjd.wheel.pl [10.0.1.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id CF8B3487F8; Fri, 24 Aug 2007 16:10:28 +0200 (CEST) Date: Fri, 24 Aug 2007 16:09:27 +0200 From: Pawel Jakub Dawidek To: Attilio Rao Message-ID: <20070824140927.GC14536@garage.freebsd.pl> References: <20070818120056.GA6498@garage.freebsd.pl> <20070818155041.GY90381@elvis.mu.org> <20070818161449.GE6498@garage.freebsd.pl> <200708211403.29293.jhb@freebsd.org> <20070821191902.GA4187@garage.freebsd.pl> <20070821202136.GB4187@garage.freebsd.pl> <3bbf2fe10708221202h44b3258cyf5ca5e9b867ac0e7@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="NU0Ex4SbNnrxsi6C" Content-Disposition: inline In-Reply-To: <3bbf2fe10708221202h44b3258cyf5ca5e9b867ac0e7@mail.gmail.com> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 7.0-CURRENT i386 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-5.9 required=3.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.0.4 Cc: Alfred Perlstein , freebsd-arch@freebsd.org Subject: Re: Lockless uidinfo. X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Aug 2007 14:10:39 -0000 --NU0Ex4SbNnrxsi6C Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 22, 2007 at 09:02:53PM +0200, Attilio Rao wrote: > 2007/8/21, Pawel Jakub Dawidek : > > > > New patch is here: > > > > http://people.freebsd.org/~pjd/patches/uidinfo_waitfree.patch >=20 > --- sys/ia64/include/atomic.h.orig > +++ sys/ia64/include/atomic.h > @@ -370,4 +370,15 @@ >=20 > #define atomic_fetchadd_int atomic_fetchadd_32 >=20 > +static __inline u_long > +atomic_fetchadd_long(volatile u_long *p, u_long v) > +{ > + u_long value; > + > + do { > + value =3D *p; > + } while (!atomic_cmpset_64(p, value, value + v)); > + return (value); > +} > + >=20 > In cycles like those, as you get spinning, I would arrange things in > order to do a cpu_spinwait(). Like this: >=20 > for (;;) { > value =3D *p; > if (atomic_cmpset_64(p, value, value + v)) > break; > cpu_spinwait(); > } In this case there is no difference as this is MI ia64 code and cpu_spinwait() is defined as /* nothing */ there. As a general rule, this might be a good idea. --=20 Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --NU0Ex4SbNnrxsi6C Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFGzuaXForvXbEpPzQRArq0AKC5/SuL8uxctj5tvAnblJ+nI0qN7wCePxwB r8unBjbr2PRLARTXynf0gEE= =937F -----END PGP SIGNATURE----- --NU0Ex4SbNnrxsi6C--