Received: by 10.192.165.148 with SMTP id m20csp890710imm; Wed, 2 May 2018 10:23:46 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpHWoL7RThIp/L/tLb0x1iX92HA6GURLgUhXFrwmUar8gm4SjKc9UYN1OfRF3tcmGOxux4L X-Received: by 2002:a63:6ec6:: with SMTP id j189-v6mr16446630pgc.86.1525281826523; Wed, 02 May 2018 10:23:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525281826; cv=none; d=google.com; s=arc-20160816; b=Rn6gMh2JUL9SbwwhsP6/u8Y3HoCJHEXpB+u7WR3UDAmWmlCkfE1NWG1JVcuKiJTbQT yh0tF2lEyrnv7H3FB8o61ZJcbMSjGalUjpDIeplg7QrDXMopom8lIQmN+Aw2Ruc1yQdg rghbpgcdcysWRFk8s5/VXoB4c88bPKdiorUsjEQ8MZNd8MwNevtGg2hy3PIXpHIfof3T SNspgyRRxhLX5JuKFhMgJx0PpMSyokDVfGSSJgBWXU+c4zniFVX2/jfm4ooFj7MpzW/9 Qz66A+zUMCXq9dXj3KIIBZ7bX/UpAjBKtJg3YmN0QW8nfnRuHDnNwaDe8OLtai6wfyat eIwQ== 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=LLlyeoMe64CPI30bfFRNIvbUKo4g+9hrUsvCAf1yDvU=; b=ookLumeF+QW+W1LudK+xnRdv20gyDgag837+ShlIGmSYjOq/4o58P4HiSy1WC42EYT m9XIN1pjQnwDuEYuHwMWqXCZEG3P4ksqiPAcQ/pvmxWgPpPP5fy9fhk/JQtzzsjGNram UBfSCY/HihE6cW3TjpkUmkk7xCfMY3WlaNZxZ8DRDL3ePJ9SkIH7yFZBiYcnLYPBQijg 1Wr0cKcLak6006bDLUs9hwNwBF1pQjTwdE9+VbW6I1CS2oqKropm8e3sgI3+k+nOdFeI VTkALnGoXKoRezBcFkgYC4o3Q2y9veRdVPVgEeaAjNkAUfZU48JgiYg1XH7BzQ4W4Aw4 b1uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=EXVuSJtK; 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 l192-v6si9943944pge.365.2018.05.02.10.23.28; Wed, 02 May 2018 10:23:46 -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=EXVuSJtK; 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 S1751240AbeEBRXA (ORCPT + 99 others); Wed, 2 May 2018 13:23:00 -0400 Received: from merlin.infradead.org ([205.233.59.134]:59256 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750942AbeEBRW5 (ORCPT ); Wed, 2 May 2018 13:22:57 -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=LLlyeoMe64CPI30bfFRNIvbUKo4g+9hrUsvCAf1yDvU=; b=EXVuSJtKX/i0Z6VBymZOd6VVE jtEWO1i+c/altJm/AP2HoQTvwi97SU/r1i0Ht9dyx2eORNlVb4lkzhGPkUMfAL4SiQjpYov5DyVKg MsnGGtb/IYVGiZ/r8kN6D0/8m3qYIpLaF5rjcYUOX1aWlda1K1sQAJzvYvpAkUpQ5GAT/3VSIgfgA BgVs2Jxx/TY65uO/FmvObOuiCuAbckhDXuYzmm5o4rDLbOkDTt+80Y9BWujITDVK7EawmZGxMv6Pt bpFMZmKZoNVWn2l1a3fGIK0RLuYMMfQetBETJirOUKTyyTQuMOi+ny1xB5xhpGWNT2mIYYCGgUvYU M+UJ4ngXA==; 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 1fDvSQ-0002Za-0F; Wed, 02 May 2018 17:22:22 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id E43732029FA14; Wed, 2 May 2018 19:22:18 +0200 (CEST) Date: Wed, 2 May 2018 19:22:18 +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: <20180502172218.GL12180@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: > Suppose we make a userspace mutex implemented with a lock word having three > bits: acquired, sleep_mode, and wait_pending, with the rest of the word not > being relevant at the moment. So ideally we'd kill FUTEX_WAIT/FUTEX_WAKE for mutexes entirely, and go with FUTEX_LOCK/FUTEX_UNLOCK that have the same semantics as the existing FUTEX_LOCK_PI/FUTEX_UNLOCK_PI, namely, the word contains the owner TID. As brought up in the last time we talked about spin loops, why do we care if the spin loop is in userspace or not? Aside from the whole PTI thing, the syscall cost was around 150 cycle or so, while a LOCK CMPXCHG is around 20 cycles. So ~7 spins gets you the cost of entry.