The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Daniel Walker <dwalker@mvista.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] futex: fix miss ordered wakeups
Date: Sat, 24 May 2008 19:03:43 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.1.10.0805241852490.3295@apollo.tec.linutronix.de> (raw)
In-Reply-To: <1211643165.18130.166.camel@localhost.localdomain>

On Sat, 24 May 2008, Daniel Walker wrote:
> On Sat, 2008-05-24 at 10:55 +0200, Thomas Gleixner wrote:
> 
> > Normal futexes have no ordering guarantees at all. There is no
> > mechanism to prevent lock stealing from lower priority tasks. So why
> > should we care about the once a year case, where a sleepers priority
> > is modified ?
> 
> Lock stealing?

Do you have the faintest idea how the futex code works at all ? There
is no guarantee that the task which is woken up first gets the futex.

A) A task on another CPU can get it independent of its priority
B) In case of multiple waiters wakeup there is no guarantee either

> The usage of sched_setscheduler is fairly pervasive in
> userspace, if a task becomes SCHED_FIFO it did so via
> sched_setscheduler.

Sigh. 

sched_setscheduler is usually done during the startup and not in the
middle of some operation.

> So I don't think this is at all "once a year". Tasks
> shouldn't be forced to determine if a task is sleeping or not before it
> calls sched_setscheduler. 

A sane written program which uses RT priorities does none of this and
I don't care about abstruse use cases at all.

> > If you need ordering guarantees then use PI futexes.
> 
> There are degree's of overhead with each step.. Someone may not need or
> want priority inheritance.

Then there is no need to add this artifical "correctness" at all.

> > There are more issues vs. pi futexes as well. The simple case of
> > futex_wait() vs. futex_adjust_waiters will just upset lockdep, but
> > there are real dealocks vs. unqueue_me_pi waiting.
> 
> You mean the lock ordering would cause the deadlock vs. unqueue_me_pi ,
> or are you talking about something else?

Do I write Chinese or what ?

Thanks,
	tglx

  reply	other threads:[~2008-05-24 17:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-22  7:00 [PATCH 1/3] mutex debug: add generic blocked_on usage Daniel Walker
2008-05-22  7:00 ` [PATCH 2/3] rtmutex: " Daniel Walker
2008-05-22  7:00 ` [PATCH 3/3] futex: fix miss ordered wakeups Daniel Walker
2008-05-23  5:02   ` Ulrich Drepper
2008-05-23  5:15     ` Daniel Walker
2008-05-23  5:24       ` Ulrich Drepper
2008-05-23  5:36         ` Daniel Walker
2008-05-24  3:38           ` Ulrich Drepper
2008-05-24  8:55   ` Thomas Gleixner
2008-05-24 15:32     ` Daniel Walker
2008-05-24 17:03       ` Thomas Gleixner [this message]
2008-05-24 17:24         ` Daniel Walker
2008-05-24 18:35           ` Thomas Gleixner
2008-05-24 19:19             ` Daniel Walker
2008-05-24 20:34               ` Arjan van de Ven

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=alpine.LFD.1.10.0805241852490.3295@apollo.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=dwalker@mvista.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