From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Gleixner Subject: Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex Date: Mon, 21 Jul 2014 20:24:56 +0200 (CEST) Message-ID: References: <1405956271-34339-1-git-send-email-Waiman.Long@hp.com> <8761iq3bp3.fsf@tassilo.jf.intel.com> <871tte3bjw.fsf@tassilo.jf.intel.com> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Return-path: In-Reply-To: <871tte3bjw.fsf@tassilo.jf.intel.com> Sender: linux-doc-owner@vger.kernel.org To: Andi Kleen Cc: Waiman Long , Ingo Molnar , Peter Zijlstra , Darren Hart , Davidlohr Bueso , Heiko Carstens , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, linux-doc@vger.kernel.org, Jason Low , Scott J Norton List-Id: linux-api@vger.kernel.org On Mon, 21 Jul 2014, Andi Kleen wrote: > Andi Kleen writes: > > > Waiman Long writes: > > > >> This patch series introduces two new futex command codes to support > >> a new optimistic spinning futex for implementing an exclusive lock > >> primitive that should perform better than the same primitive using > >> the wait-wake futex in cases where the lock owner is actively working > >> instead of waiting for I/O completion. > > > > How would you distinguish those two cases automatically? > > Also BTW traditionally the spinning was just done in user space. And traditionally that is based on heuristics, because user space cannot figure out whether the lock owner is on the CPU or not. And heuristics suck no matter what. There have been attempts to expose that information to user space, but that sucks as well, as it requires updates of that information from the guts of the scheduler, does not scale at all and what's worse, it has security implications. Thanks, tglx