From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938825AbcIVU2k (ORCPT ); Thu, 22 Sep 2016 16:28:40 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:39279 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934925AbcIVU2g (ORCPT ); Thu, 22 Sep 2016 16:28:36 -0400 Date: Thu, 22 Sep 2016 22:26:01 +0200 (CEST) From: Thomas Gleixner To: Waiman Long cc: Peter Zijlstra , Mike Galbraith , Ingo Molnar , Jonathan Corbet , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Davidlohr Bueso , Jason Low , Scott J Norton , Douglas Hatch Subject: Re: [RFC PATCH v2 3/5] futex: Throughput-optimized (TO) futexes In-Reply-To: <57E4377B.7090907@hpe.com> Message-ID: References: <1474378963-15496-1-git-send-email-Waiman.Long@hpe.com> <1474378963-15496-4-git-send-email-Waiman.Long@hpe.com> <1474441172.27308.19.camel@gmail.com> <57E319BE.2050208@hpe.com> <20160922074932.GV5008@twins.programming.kicks-ass.net> <57E4377B.7090907@hpe.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 22 Sep 2016, Waiman Long wrote: > On 09/22/2016 09:34 AM, Thomas Gleixner wrote: > > On Thu, 22 Sep 2016, Peter Zijlstra wrote: > > > > > > I'd leave out the TO part entirely (or only mention it in changelogs). > > > > > > That is, I'd call the futex ops: FUTEX_LOCK and FUTEX_UNLOCK. > > That brings me to a different question: > > > > How is user space going to support this, i.e. is this some extra magic for > > code which implements its own locking primitives or is there going to be a > > wide use via e.g. glibc. > > There are some applications that use futex(2) directly to implement their > synchronization primitives. For those applications, they will need to modify > their code to detect the presence of the new futexes. They can then use the > new futexes if available and use wait-wake futexes if not. That's what I suspected. Did you talk to the other folks who complain about futex performance (database, JVM, etc.) and play their own games with user space spinlocks and whatever? > I am also planning to take a look at the pthread_mutex* APIs to see if they > can be modified to use the new futexes later on when the patch becomes more > mature. Please involve glibc people who are interested in the futex stuff early and discuss the concept before it's set in stone for your particular usecase. > > Also what's the reason that we can't do probabilistic spinning for > > FUTEX_WAIT and have to add yet another specialized variant of futexes? > > > > The main reason is that a FUTEX_WAIT waiter has no idea who the owner of the > futex is. We usually do spinning when the lock owner is running and abort when > it goes to sleep. We can't do that for FUTEX_WAIT. Fair enough. This wants to be spelled out in the changelog and explained a bit more detailed. Thanks, tglx