From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754861AbcESMYS (ORCPT ); Thu, 19 May 2016 08:24:18 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:46289 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751399AbcESMYR (ORCPT ); Thu, 19 May 2016 08:24:17 -0400 Date: Thu, 19 May 2016 14:24:06 +0200 From: Peter Zijlstra To: Thomas Gleixner Cc: LKML , Sebastian Andrzej Siewior , Linus Torvalds , Darren Hart , Ingo Molnar , Michael Kerrisk , Davidlohr Bueso , Chris Mason , "Carlos O'Donell" , Torvald Riegel , Eric Dumazet Subject: Re: [patch V2 2/7] futex: Hash private futexes per process Message-ID: <20160519122406.GA3192@twins.programming.kicks-ass.net> References: <20160505204230.932454245@linutronix.de> <20160505204353.973009518@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160505204353.973009518@linutronix.de> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 05, 2016 at 08:44:04PM -0000, Thomas Gleixner wrote: > +static struct futex_hash_bucket *hash_futex(union futex_key *key) > +{ > +#ifdef CONFIG_FUTEX_PRIVATE_HASH > + struct mm_struct *mm = current->mm; > + unsigned int slot; > + > + /* > + * Futexes which use the per process hash have the lower bits cleared > + */ > + if (key->both.offset & (FUT_OFF_INODE | FUT_OFF_MMSHARED)) > + return hash_global_futex(key); > + > + slot = hash_long(key->private.address, mm->futex_hash.hash_bits); > + return &mm->futex_hash.hash[slot]; Do we want the option to WARN if we get collisions in this per-process hash? Because afaiu there is no guarantee what so ever this doesn't happen, and collisions here can create the very same priority inversions as are possible in the global hash. Less likely etc.. more contained since its only the threads of the one process that get tangled up, but still possible. > +#else > + return hash_global_futex(key); > +#endif > +}