From owner-svn-src-all@FreeBSD.ORG Tue Jan 5 04:40:06 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3BCBC1065670; Tue, 5 Jan 2010 04:40:06 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.26]) by mx1.freebsd.org (Postfix) with ESMTP id 2AF0C8FC21; Tue, 5 Jan 2010 04:40:04 +0000 (UTC) Received: by qw-out-2122.google.com with SMTP id 9so3572945qwb.7 for ; Mon, 04 Jan 2010 20:39:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:in-reply-to:references:x-mailer:mime-version :content-type; bh=pbeJsc0nKMHfB1BruYzPMiJvotHLmGE33jhbJ9OiYUU=; b=HkcYk2L6rHlTpFDxzdpxl9cjr8hSZ0nGAe0DeELjuR7n3BM1xYCm0tfD5hupovGNoJ mqpEMVFL1bk1fTt5N89F2RSlUdsmgORTnf3rCIlu2W2GnYd/KhffAECCsPvXS8vYn46J 4S3v24wtVXnxHMZDjEthLTnFNlg6/rgyWbbn0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type; b=NeHtnsZGYjTl1OR3K5bwHnFGPLMBBe4S8yprkJIdIIkGhfc6TEcrNLdVafQDs3CCum PMTiNr43vDXti14HkGTqZcerlMec4Dwu93lGVEHc0x689+8DzxSumtysBzU1nrkgMvkf Pts6fPtdchJ7oUZD9pxv5F22FjkgDlUXmx4FY= Received: by 10.224.66.211 with SMTP id o19mr11642572qai.342.1262666396117; Mon, 04 Jan 2010 20:39:56 -0800 (PST) Received: from kan.dnsalias.net (c-24-91-218-112.hsd1.ma.comcast.net [24.91.218.112]) by mx.google.com with ESMTPS id 4sm15137889qwe.55.2010.01.04.20.39.51 (version=SSLv3 cipher=RC4-MD5); Mon, 04 Jan 2010 20:39:55 -0800 (PST) Date: Mon, 4 Jan 2010 23:39:46 -0500 From: Alexander Kabaev To: David Xu Message-ID: <20100104233946.6d8bfa37@kan.dnsalias.net> In-Reply-To: <201001050339.o053dV1j075171@svn.freebsd.org> References: <201001050339.o053dV1j075171@svn.freebsd.org> X-Mailer: Claws Mail 3.7.3 (GTK+ 2.18.5; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/iIY41kDyQ_qlTyTTcA7e/_S"; protocol="application/pgp-signature" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r201547 - head/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2010 04:40:06 -0000 --Sig_/iIY41kDyQ_qlTyTTcA7e/_S Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi, some quick questions: FB10_COMPAT_PRIVATE is not used anywhere, why did it get committed? That aside, use of SYM_DEFAULT is pretty much always wrong. Also, does libthr really need to export sem_ symbols in 1.2 namespace? I do not think so, but there might be reasons I am missing, could you shed some light here? On Tue, 5 Jan 2010 03:39:31 +0000 (UTC) David Xu wrote: > Author: davidxu > Date: Tue Jan 5 03:39:31 2010 > New Revision: 201547 > URL: http://svn.freebsd.org/changeset/base/201547 >=20 > Log: > Don't check has_waiters twice, inline some small functions. > performance result on my machine: > mutex Elapsed: 902115 us; per iteration: 90 ns. > semaphore Elapsed: 958780 us; per iteration: 95 ns. >=20 > Modified: > head/lib/libc/gen/sem_new.c >=20 > Modified: head/lib/libc/gen/sem_new.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libc/gen/sem_new.c Tue Jan 5 02:37:59 > 2010 (r201546) +++ head/lib/libc/gen/sem_new.c Tue Jan > 5 03:39:31 2010 (r201547) @@ -331,7 +331,7 @@ > _libc_sem_getvalue(sem_t * __restrict se return (0); > } > =20 > -static int > +static __inline int > usem_wake(struct _usem *sem) > { > if (!sem->_has_waiters) > @@ -339,7 +339,7 @@ usem_wake(struct _usem *sem) > return _umtx_op(sem, UMTX_OP_SEM_WAKE, 0, NULL, NULL); > } > =20 > -static int > +static __inline int > usem_wait(struct _usem *sem, const struct timespec *timeout) > { > if (timeout && (timeout->tv_sec < 0 || (timeout->tv_sec =3D=3D 0 > && @@ -387,7 +387,7 @@ sem_cancel_handler(void *arg) > } while (0) > =20 > =20 > -static int > +static __inline int > enable_async_cancel(void) > { > int old; > @@ -396,7 +396,7 @@ enable_async_cancel(void) > return (old); > } > =20 > -static void > +static __inline void > restore_async_cancel(int val) > { > _pthread_setcanceltype(val, NULL); > @@ -413,7 +413,6 @@ _libc_sem_timedwait(sem_t * __restrict s > return (-1); > =20 > retval =3D 0; > - _pthread_testcancel(); > for (;;) { > while ((val =3D sem->_kern._count) > 0) { > if > (atomic_cmpset_acq_int(&sem->_kern._count, val, val - 1)) @@ -464,7 > +463,5 @@ _libc_sem_post(sem_t *sem) return (-1); > =20 > atomic_add_rel_int(&sem->_kern._count, 1); > - if (sem->_kern._has_waiters) > - return usem_wake(&sem->_kern); > - return (0); > + return usem_wake(&sem->_kern); > } --=20 Alexander Kabaev --Sig_/iIY41kDyQ_qlTyTTcA7e/_S Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.13 (FreeBSD) iD8DBQFLQsKWQ6z1jMm+XZYRArwyAJwOc/6JtClBjYxuHbGvwayJtQ5KpwCfQStd sgXlj8pE9DNj3cwia4tZsws= =JzuK -----END PGP SIGNATURE----- --Sig_/iIY41kDyQ_qlTyTTcA7e/_S--