public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pierre Peiffer <pierre.peiffer@bull.net>
To: "Sébastien Dugué" <sebastien.dugue@bull.net>
Cc: Jakub Jelinek <jakub@redhat.com>,
	Arjan van de Ven <arjan@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Atsushi Nemoto <anemo@mba.ocn.ne.jp>,
	linux-kernel@vger.kernel.org
Subject: Re: NPTL mutex and the scheduling priority
Date: Tue, 13 Jun 2006 10:39:54 +0200	[thread overview]
Message-ID: <448E79DA.8050704@bull.net> (raw)
In-Reply-To: <1150125869.3835.12.camel@frecb000686>

Sébastien Dugué a écrit :
>   But maybe a better solution for condvars would be to implement
> something like a futex_requeue_pi() to handle the broadcast and
> only use PI futexes all along in glibc.
> 
>   Any ideas?

I'm currently thinking about it, and as far as I can see, it should be
technically feasible but not obvious.
In fact, PI-futex adds a rt-mutex behind each futex, when there are some
waiters. Each waiter is then queued two times: once in the chain list of
the hash-bucket, once in the (ordered) wait_list of the rt-mutex.

What we want, with a futex_requeue_pi, is a requeue of some tasks from
(futex1, rt_mutex1) to (futex2, rt_mutex2), respecting the wait_list
order of rt_mutex1.wait-list.
=> this needs something like a rt_mutex_requeue, and given an element of
rt_mutex1.wait_list, we need to retrieve its futex_q to requeue it to
the second hash-bucket chain (of futex2).

Moreover, we must take care of the case where the futex2 is not yet
locked (i.e. has no owner): there is not yet a pi_state nor a rt_mutex
associated with the futex2 ...

And during all of this, we must take care of several race conditions in
several places.

I'll continue my investigation, but I really wonder if futex_requeue_pi
will still be an "optimization" as it should be.

So comments from the experts are welcome ;-)

-- 
Pierre


  parent reply	other threads:[~2006-06-13  8:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-12  8:10 NPTL mutex and the scheduling priority Atsushi Nemoto
2006-06-12 12:23 ` Arjan van de Ven
2006-06-12 12:44   ` Jakub Jelinek
2006-06-12 15:24     ` Sébastien Dugué
2006-06-12 16:06       ` Atsushi Nemoto
2006-09-07  8:11         ` Atsushi Nemoto
2006-09-07  8:32           ` Jakub Jelinek
2006-09-07  9:30             ` Atsushi Nemoto
2006-09-07  9:37               ` Andreas Schwab
2006-09-07  9:42                 ` Atsushi Nemoto
2006-06-13  8:39       ` Pierre Peiffer [this message]
2006-06-13  8:48       ` Jakub Jelinek
2006-06-13 12:04         ` Sébastien Dugué
2006-06-13 12:56           ` Jakub Jelinek
2006-06-14 13:19             ` Sébastien Dugué
2006-06-14 13:28               ` Jakub Jelinek
2006-06-14 13:38               ` Pierre Peiffer
2006-06-15  9:28               ` Pierre Peiffer

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=448E79DA.8050704@bull.net \
    --to=pierre.peiffer@bull.net \
    --cc=anemo@mba.ocn.ne.jp \
    --cc=arjan@infradead.org \
    --cc=jakub@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=sebastien.dugue@bull.net \
    /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