mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Joseph Seigh" <jwseigh_055@hotmail.com>
To: linux-kernel@vger.kernel.org
Subject: Futex wake behavior question
Date: Wed, 10 Nov 2004 08:02:56 -0500	[thread overview]
Message-ID: <BAY22-F224OPXok84FT00006346@hotmail.com> (raw)

(2nd try at posting this.  from different email acct this time)

I have a question about futex wake behavior.  On a uniprocessor is
it supposed to preempt the caller and dispatch the woken thread if
all threads in question have equal priority?

I was playing around with an experimental lock-free implementation
of condvars (no internal lock) and I got a 30% performance improvement
over NPTL's implementation which I didn't expect since the mutex the
condvar is bound to tends to be the gating factor.  I did getrusage()
to get some stats and noticed the context switching was proportional
to the condvar signaling, the difference between the NPTL and lock-free
versions being one context switch which I attribute to NPTL's internal
mutex.

As a side note, since wait morphing doesn't appear to be currently
implemented in NPTL, you get a performance boost from signaling while
not holding the mutex since the first thing the woken thread does is
try to get the lock.  Even with this technique, the lock-free condvar
does better.

This behavior would also cause problems for semaphores and tend to turn
semaphore calls into expensive coroutine calls.

So the question is, is this a feature or a bug?  I'm on Suse 9.2 on
a uniprocessor.  The kernel is 2.6.8-24 and NPTL is 2.3.3.


Joe Seigh

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


                 reply	other threads:[~2004-11-10 13:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=BAY22-F224OPXok84FT00006346@hotmail.com \
    --to=jwseigh_055@hotmail.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®