From: Thomas Gleixner <tglx@linutronix.de>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Gerd Gerats <gerd.gerats.lkml@gmx.de>,
mingo@redhat.com, dvhart@infradead.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] futex: hashbucket as list of futex instead of waiters
Date: Thu, 28 Sep 2017 14:13:49 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.20.1709281412410.1879@nanos> (raw)
In-Reply-To: <20170928105814.cfzsyi42asybctfo@hirez.programming.kicks-ass.net>
On Thu, 28 Sep 2017, Peter Zijlstra wrote:
> On Sun, Sep 10, 2017 at 11:41:58PM +0200, Gerd Gerats wrote:
> > When using futex as a condition variable, for example: to manage a
> > threadpool, there may be a lot of threads inside the futex_wait to sleep on
> > this futex. The futex_hash_bucket consists therefore of many struct futex_q
> > for the same futex.
> >
> > On bad luck another futex, used as mutex, hashed into the same bucket.
> > Every futex_wake on this mutex, has to scan the whole chain of above waiter
> > to find the struct futex_q for this mutex. For non-unusual threadpool sizes
> > of more than 20, this should be a considerable effort.
> >
> > I therefore suggest to include in the hash-bucketchain only one struct
> > futex_q per futex and to queue additional waiter in an extrachain at the
> > 'top' futex_q entry. Thus different futex are isolated from each other, the
> > cost of a hash collision is reduced.
>
> So I don't dislike that idea.. however
>
> > To show the idea, I added a sample patch. Here, the plist is exchanged for
> > a futex-specific implementation. kernel/pring.h is certainly not not the
> > right place.
>
> So I suppose the purpose of that plist in futex is to enable waking up
> the highest prio waiter, but with the advent of SCHED_DEADLINE that no
> longer works.
>
> I think Thomas resisted going the RB-tree route earlier..
The only problem I see with the RB tree is the performance overhead and
people are constantly complaining about futex performance anyway. But it
might be worth a try.
Thanks,
tglx
next prev parent reply other threads:[~2017-09-28 12:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-10 21:41 Gerd Gerats
2017-09-28 10:58 ` Peter Zijlstra
2017-09-28 12:13 ` Thomas Gleixner [this message]
2017-09-28 22:39 ` Gerd Gerats
2017-09-29 8:36 ` Peter Zijlstra
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.DEB.2.20.1709281412410.1879@nanos \
--to=tglx@linutronix.de \
--cc=dvhart@infradead.org \
--cc=gerd.gerats.lkml@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.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®