Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1440838179.693.4.camel@dysnomia.u-strasbg.fr>
Date: Sat, 29 Aug 2015 10:50:44 +0200
From: Jens Gustedt <Jens.Gustedt@...ia.fr>
To: musl@...ts.openwall.com
Subject: [PATCH 1/2] let them spin

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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.