Received: by 10.192.165.148 with SMTP id m20csp378870imm; Wed, 2 May 2018 01:45:23 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpdpEq9oz242nmSKVB5ysD44aBbb2Jn+jFO+4M92nNFwqMARju0CSPjMC3cKeltZc/5PhGG X-Received: by 2002:a17:902:7615:: with SMTP id k21-v6mr4878261pll.97.1525250723691; Wed, 02 May 2018 01:45:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525250723; cv=none; d=google.com; s=arc-20160816; b=DFjxExW0v4StqfboKSSfdR4Y4UUVmgqwipENs0qHuIsdpdMuTDxuvscvd+sjAKkiXt 3EaY+dcLlw+b9dxt0aJNM6VefegYZczGJK+FRZfnIxU1B8ULSeD0f8zPvL+VHZMbmqiu vo4FjM72Ee8/9oM8IyjK3A+Pr9bhppXsr57qTvM64gjDY8SRlrJpJS4XjyekMzaNMVxi WaCIT57y2GkHqmXRp969mzmCZXyH5zdwAb/ynCVcJiwTJGQrbfeOILd8l/PcgOqr01up ZL2qKLmKrcoPjYeCia2K9Pf/MOqLtUPv312cfpXiBzpECIw5XCKFVnW7n75qE31kCN6J gmPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=hSJr2eRn112jBhxRfIpodxrzuDcfpYog5WRnw/268oE=; b=S2BSiLHw4QIgsocVXF7Wovx9uNPFi5YgF6Jha5MJ0kf87tf1wkrX5t9LKHthyDknmN 6Y9Q/i6mY5nxW41V2tmj3R/qwcmxrvf109J2VxRQKHCKiU7qS0HG/LRZAzIISmNmikLo 6LiRuGJd656u1x9RcTgnFxmH2LWxMMVBtbxRc65Y/JfOo1f+hGYKuwRSyEhxji7t3+xB ojGFirQyxOJCgXgo1hsD26Qzlq9Of8x+YnWrdiV7f81O46L8bKjIy8wMIrup1Dq4XQ3A TbprVnoDeyyciNYnYN2hVS+En4jwzkI2HjjiwuQ3pLbbaxObDv01zVg6+og+F56newTQ yPjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=Urz6CUvP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p11-v6si2328909plk.294.2018.05.02.01.45.09; Wed, 02 May 2018 01:45:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=Urz6CUvP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751268AbeEBIo5 (ORCPT + 99 others); Wed, 2 May 2018 04:44:57 -0400 Received: from merlin.infradead.org ([205.233.59.134]:52940 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750859AbeEBIoy (ORCPT ); Wed, 2 May 2018 04:44:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=hSJr2eRn112jBhxRfIpodxrzuDcfpYog5WRnw/268oE=; b=Urz6CUvP3q/2PEbaIaz9zVA7B JtaSfjzlPIf2ye4opte8qEFhmHXJllQddnVpmjObvcvu/rnLHFWERLg4Ol1Qp78o3AeA/Goe/5MtM KUSzzk+TCC13lfbx3IwtA0UbY2ciufZbQUDBzABvjYchRblcEwRkp4M0IbT+CyDr1R73b+27cSFzq 5a1ayIlBKCD4XvyEl74ArU91QWi8anHpRriSAw6t9LlEVDsbWLUF+IA091aek5FPFObvw4GymPtWC WC5Lf6Ypmz8VCvvkEh0zkmtumag8V6IW4BTq+ksfZMG5jrh+v3uIQohLBzdhLbEr8Vnb/xXQHoYzR eV2g/DQrw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fDnMH-0007kl-G4; Wed, 02 May 2018 08:43:29 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 36E9F2029FA14; Wed, 2 May 2018 10:43:28 +0200 (CEST) Date: Wed, 2 May 2018 10:43:28 +0200 From: Peter Zijlstra To: Daniel Colascione Cc: mathieu.desnoyers@efficios.com, paulmck@linux.vnet.ibm.com, boqun.feng@gmail.com, luto@amacapital.net, davejwatson@fb.com, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, pjt@google.com, Andrew Morton , linux@arm.linux.org.uk, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, Andrew Hunter , andi@firstfloor.org, cl@linux.com, bmaurer@fb.com, rostedt@goodmis.org, josh@joshtriplett.org, torvalds@linux-foundation.org, catalin.marinas@arm.com, will.deacon@arm.com, mtk.manpages@gmail.com, Joel Fernandes Subject: Re: [RFC PATCH for 4.18 00/14] Restartable Sequences Message-ID: <20180502084328.GE12180@hirez.programming.kicks-ass.net> References: <20180430224433.17407-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 02, 2018 at 03:53:47AM +0000, Daniel Colascione wrote: > The usual approach to "better" is an "adaptive mutex". Such a thing, when > it attempts to acquire a lock another thread owns, spins for some number of > iterations, then falls back to futex. I guess that's a little better than > immediately jumping to futex, but it's not optimal. We can still spin when > the lock owner isn't scheduled, and the spin count is usually some guess > (either specified manually or estimated statistically) that's not > guaranteed to produce decent results. Even if we do pick a good spin count, > we run a very good chance of under- or over-spinning on any given > lock-acquire. We always want to sleep when spinning would be pointless. Look for the FUTEX_LOCK patches from Waiman.