From: "Sébastien Dugué" <sebastien.dugue@bull.net>
To: Jakub Jelinek <jakub@redhat.com>
Cc: tglx@linutronix.de, Ingo Molnar <mingo@elte.hu>,
LKML <linux-kernel@vger.kernel.org>,
Ulrich Drepper <drepper@redhat.com>
Subject: Re: [RFC][PATCH RT 0/2] futex priority based wakeup
Date: Thu, 18 May 2006 10:51:16 +0200 [thread overview]
Message-ID: <1147942276.4996.23.camel@frecb000686> (raw)
In-Reply-To: <20060516103644.GH25570@devserv.devel.redhat.com>
On Tue, 2006-05-16 at 06:36 -0400, Jakub Jelinek wrote:
> On Thu, May 11, 2006 at 10:56:57AM +0200, S?bastien Dugu? wrote:
> > Hm, I wonder what would be the effect of having the external mutex
> > and __data.__lock use a PI futex and __data.__futex use a regular
> > futex when the waiters on __data.__futex are requeued on the external
> > mutex during a broadcast.
>
> Well, either glibc can stop using requeue if the mutex is PI mutex (and use
> the slower fallback), or kernel would need to handle requeueing from normal to
> PI futex.
Yes, or make the condvar use a PI futex and implement a
futex_requeue_pi() and have glibc use that in the broadcast case. I
think the requeue thing is a good idea and should not be dropped.
>
> > > > But, there is a problem here - pthread_cond_{signal,broadcast} don't
> > > > have any associated mutexes, so you often don't know which type
> > > > of protocol you want to use for the internal condvar lock.
> >
> > Just a wild guess here, but in the broadcast or signal path, couldn't
> > __data.__mutex be looked up to determine what protocol to use for the
> > __data.__futex?
>
> Not always.
> Say if you do:
> thread1 (low prio) thread2 (very high prio) thread3 (mid prio)
> pthread_cond_signal (&cv)
> # first use of cv in the program, no mutex has been ever used with this
> # condvar
> lll_mutex_lock (&cv->__data.__lock)
> pthread_cond_wait (&cv, &pi_mutex)
> lll_mutex_lock (&cv->__data.__lock)
> use_all_CPU
> # Then thread2 is stuck, waiting on thread1 which waits on thread3
>
> At pthread_cond_signal enter time you don't know the type of associated
> mutex, so you don't know which kind of internal lock to use.
> It doesn't have to be the first use of cv in the program, similarly it can
> be any pthread_cond_{signal,broadcast} called while there are no threads
> in pthread_cond_*wait on that cv.
OK, it makes sense now, thanks.
Sébastien.
next prev parent reply other threads:[~2006-05-18 8:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-10 9:26 Sébastien Dugué
2006-05-10 10:08 ` Ingo Molnar
2006-05-10 13:03 ` Sébastien Dugué
2006-05-10 14:32 ` Thomas Gleixner
2006-05-10 15:01 ` Jakub Jelinek
2006-05-10 17:02 ` Thomas Gleixner
2006-05-11 8:56 ` Sébastien Dugué
2006-05-16 10:36 ` Jakub Jelinek
2006-05-18 8:51 ` Sébastien Dugué [this message]
2006-05-12 13:32 ` 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=1147942276.4996.23.camel@frecb000686 \
--to=sebastien.dugue@bull.net \
--cc=drepper@redhat.com \
--cc=jakub@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/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
Powered by JetHome