From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8396 Path: news.gmane.org!not-for-mail From: Jens Gustedt Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH 1/2] let them spin Date: Sat, 29 Aug 2015 10:50:44 +0200 Message-ID: <1440838179.693.4.camel@dysnomia.u-strasbg.fr> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1440838276 19175 80.91.229.3 (29 Aug 2015 08:51:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 29 Aug 2015 08:51:16 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-8408-gllmg-musl=m.gmane.org@lists.openwall.com Sat Aug 29 10:51:11 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1ZVbqv-0005hX-98 for gllmg-musl@m.gmane.org; Sat, 29 Aug 2015 10:51:09 +0200 Original-Received: (qmail 6018 invoked by uid 550); 29 Aug 2015 08:51:01 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 5973 invoked from network); 29 Aug 2015 08:50:57 -0000 X-IronPort-AV: E=Sophos;i="5.17,429,1437429600"; d="scan'208";a="175269654" Resent-From: Jens Gustedt Resent-To: musl@lists.openwall.com X-Mailer: Evolution 3.12.9-1+b1 Xref: news.gmane.org gmane.linux.lib.musl.general:8396 Archived-At: Remove a test in __wait that looked if other threads already attempted to go to sleep in futex_wait. This has no impact on the fast path. But other than one might think at a first glance, this slows down if there is congestion. Applying this patch shows no difference in behavior in a mono-core setting, so it seems that this shortcut is just superfluous. --- src/thread/__wait.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thread/__wait.c b/src/thread/__wait.c index dc33c1a..a93d41d 100644 --- a/src/thread/__wait.c +++ b/src/thread/__wait.c @@ -4,7 +4,7 @@ void __wait(volatile int *addr, volatile int *waiters, int val, int priv) { int spins=100; if (priv) priv = FUTEX_PRIVATE; - while (spins-- && (!waiters || !*waiters)) { + while (spins--) { if (*addr==val) a_spin(); else return; } -- 2.1.4