From: Jens Gustedt <Jens.Gustedt@inria.fr>
To: musl@lists.openwall.com
Subject: [PATCH 1/2] let them spin
Date: Sat, 29 Aug 2015 10:50:44 +0200 [thread overview]
Message-ID: <1440838179.693.4.camel@dysnomia.u-strasbg.fr> (raw)
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
next reply other threads:[~2015-08-29 8:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-29 8:50 Jens Gustedt [this message]
2015-08-29 17:16 ` Rich Felker
2015-08-29 19:38 ` Jens Gustedt
2015-08-30 0:39 ` Rich Felker
2015-08-30 8:41 ` Jens Gustedt
2015-08-30 17:02 ` Rich Felker
2015-08-30 21:48 ` Jens Gustedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1440838179.693.4.camel@dysnomia.u-strasbg.fr \
--to=jens.gustedt@inria.fr \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).