mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Peter Zijlstra <peterz@infradead.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Darren Hart <darren@dvhart.com>, Ingo Molnar <mingo@kernel.org>,
	Michael Kerrisk <mtk.manpages@googlemail.com>,
	Davidlohr Bueso <dave@stgolabs.net>, Chris Mason <clm@fb.com>,
	"Carlos O'Donell" <carlos@redhat.com>,
	Torvald Riegel <triegel@redhat.com>,
	Eric Dumazet <edumazet@google.com>
Subject: Re: [RFC patch 4/7] futex: Add support for attached futexes
Date: Sat, 2 Apr 2016 20:01:29 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.11.1604021959120.3978@nanos> (raw)
In-Reply-To: <20160402162632.GQ3448@twins.programming.kicks-ass.net>

On Sat, 2 Apr 2016, Peter Zijlstra wrote:
> On Sat, Apr 02, 2016 at 11:09:18AM -0000, Thomas Gleixner wrote:
> > +/**
> > + * hash_local_futex - Return the hash bucket in the task local cache
> > + * @uaddr:	The user space address of the futex
> > + * @prime:	The prime number for the modulo operation
> > + *
> > + * That's a primitive hash function, but it turned out to be the most
> > + * efficient one for the task local cache as we don't have anything to
> > + * mix in like we have for the global hash.
> > + */
> > +static inline unsigned int
> > +hash_local_futex(void __user *uaddr, unsigned int prime)
> > +{
> > +	return ((unsigned long) uaddr) % prime;
> > +}
> 
> > +static unsigned int hash_prime(unsigned int size)
> > +{
> > +	switch(size) {
> > +	case   16:
> > +	default:   return 13;
> > +	case   32: return 31;
> > +	case   64: return 61;
> > +	case  128: return 127;
> > +	case  256: return 251;
> > +	case  512: return 509;
> > +	case 1024: return 1021;
> > +	case 2048: return 2039;
> > +	case 4096: return 4093;
> > +	}
> > +}
> 
> One wonders what's wrong with include/linux/hash.h ? It appears to me
> hash_ptr() is pretty much what you want, no?

Nothing is wrong with that. Just my futex fried brain not being able to see
the obvious:)

Thanks,

	tglx

  reply	other threads:[~2016-04-02 18:03 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-02 11:09 [RFC patch 0/7] " Thomas Gleixner
2016-04-02 11:09 ` [RFC patch 1/7] futex: Provide helpers for hash bucket add/remove Thomas Gleixner
2016-04-02 11:09 ` [RFC patch 2/7] futex: Add some more function commentry Thomas Gleixner
2016-04-02 11:09 ` [RFC patch 3/7] futex: Make key init a helper function Thomas Gleixner
2016-04-02 11:09 ` [RFC patch 4/7] futex: Add support for attached futexes Thomas Gleixner
2016-04-02 16:26   ` Peter Zijlstra
2016-04-02 18:01     ` Thomas Gleixner [this message]
2016-04-02 16:29   ` Peter Zijlstra
2016-04-03  9:59     ` Thomas Gleixner
2016-04-02 18:19   ` Andy Lutomirski
2016-04-03  9:57     ` Thomas Gleixner
2016-04-03 13:18       ` Andy Lutomirski
2016-04-03 15:56         ` Thomas Gleixner
2016-04-03 16:11           ` Andy Lutomirski
2016-04-02 23:48   ` Rasmus Villemoes
2016-04-03 10:05     ` Thomas Gleixner
2016-04-03 11:16   ` Ingo Molnar
2016-04-03 11:30     ` Linus Torvalds
2016-04-05  7:44       ` Torvald Riegel
2016-04-05 15:58       ` Carlos O'Donell
2016-04-02 11:09 ` [RFC patch 5/7] perf/bench/futex-hash: Support " Thomas Gleixner
2016-04-02 11:09 ` [RFC patch 7/7] [PATCH] glibc: nptl: Add support for attached pthread_mutexes Thomas Gleixner
2016-04-02 16:30   ` Peter Zijlstra
2016-04-02 16:32     ` Peter Zijlstra
2016-04-03 10:08     ` Thomas Gleixner
2016-04-02 11:09 ` [RFC patch 6/7] futex.2: Document attached mode Thomas Gleixner

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.11.1604021959120.3978@nanos \
    --to=tglx@linutronix.de \
    --cc=bigeasy@linutronix.de \
    --cc=carlos@redhat.com \
    --cc=clm@fb.com \
    --cc=darren@dvhart.com \
    --cc=dave@stgolabs.net \
    --cc=edumazet@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mtk.manpages@googlemail.com \
    --cc=peterz@infradead.org \
    --cc=triegel@redhat.com \
    /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®