mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Andrew Morton <akpm@osdl.org>,
	Ulrich Drepper <drepper@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] FUTEX_WAKE_OP (pthread_cond_signal speedup)
Date: Tue, 23 Aug 2005 10:36:08 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.58.0508231033270.18304@devserv.devel.redhat.com> (raw)
In-Reply-To: <20050823131817.GA7403@devserv.devel.redhat.com>


On Tue, 23 Aug 2005, Jakub Jelinek wrote:

> Hi!
> 
> ATM pthread_cond_signal is unnecessarily slow, because it wakes one
> waiter (which at least on UP usually means an immediate context switch
> to one of the waiter threads).  This waiter wakes up and after a few
> instructions it attempts to acquire the cv internal lock, but that lock
> is still held by the thread calling pthread_cond_signal.  So it goes
> to sleep and eventually the signalling thread is scheduled in, unlocks
> the internal lock and wakes the waiter again.


> With the following benchmark on UP x86-64 I get:
> 
> for i in nptl-orig nptl-requeue nptl-wake_op; do echo time elf/ld.so --library-path .:$i /tmp/bench; \
> for j in 1 2; do echo ( time elf/ld.so --library-path .:$i /tmp/bench ) 2>&1; done; done
> time elf/ld.so --library-path .:nptl-orig /tmp/bench
> real 0m0.655s user 0m0.253s sys 0m0.403s
> real 0m0.657s user 0m0.269s sys 0m0.388s
> time elf/ld.so --library-path .:nptl-requeue /tmp/bench
> real 0m0.496s user 0m0.225s sys 0m0.271s
> real 0m0.531s user 0m0.242s sys 0m0.288s
> time elf/ld.so --library-path .:nptl-wake_op /tmp/bench
> real 0m0.380s user 0m0.176s sys 0m0.204s
> real 0m0.382s user 0m0.175s sys 0m0.207s

translation: effective thread switching is now almost twice as fast with
the WAKE_OP extension of the futex interface. Cool!

a detail: many of the futex_atomic_op_inuser() seem to be duplicated
across architectures. Might be worth putting into asm-generic, to avoid
the duplication?

	Ingo

  reply	other threads:[~2005-08-23 14:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-23 13:18 Jakub Jelinek
2005-08-23 14:36 ` Ingo Molnar [this message]
2005-08-23 14:42   ` Jakub Jelinek

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=Pine.LNX.4.58.0508231033270.18304@devserv.devel.redhat.com \
    --to=mingo@redhat.com \
    --cc=akpm@osdl.org \
    --cc=drepper@redhat.com \
    --cc=jakub@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®