Received: by 2002:ab2:3c46:0:b0:1f5:f2ab:c469 with SMTP id x6csp228269lqf; Fri, 26 Apr 2024 05:16:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVJv9ESQvZ9NoCOrofKBCP7kDx7mQRYLArkYon0t/W3i8xCc4Z/TL53wgwx+sBUYvUK6OWMVTGkUzOEr4HIacFZj9N7DoAz2tX5R7iR2w== X-Google-Smtp-Source: AGHT+IEg4Urt2h/JpWAdLx8rhCcvcxS/nsNuOc2e2XBFAXJmW8WtWSVJvl+ZkWv7bUVUGgcTpYl1 X-Received: by 2002:a17:903:32cf:b0:1e5:62:7abe with SMTP id i15-20020a17090332cf00b001e500627abemr2552828plr.3.1714133787378; Fri, 26 Apr 2024 05:16:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714133787; cv=pass; d=google.com; s=arc-20160816; b=nXeOS2ELpoq4DVcvE/e78YTaNJ2LdGbbhz7aQcilwoAoNmrrbNs9WJfjsVBEap1fwb QPDlE+BDLVhxc/k2zcFr1DstIYjKYEVFQmzYZ13DM65K244CGx9A9TRo2isxDbVdsgDl PUlYbWKtdvQsh38hqASuF7OMKwNJpWSWr7pf7Erep1Kd/OTjyDKCkl2ZQMq8M3kB9PtO Z7ewMXzr5kQkaV2Bco1atd34k/TewjXIl+48x5hNnZ7FvRkI9VZSseN9rROQVSaz/NiB UwVCp048fz4rOJvm65gsvLctLE1/ImCilOjJD5vMJLdb3eqFICwEwef9heqBjYvS2WZA XU4g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ryVjswdoVqQB3NDQl33vADKSu7VWuONlL8jqOs+n9Sc=; fh=pmNTERsxYL7/I/Nn9D298R3Gq+Gp49OBt9UoHSzATDU=; b=Ae6TWGAD3Sx7nwEdRr+zkwATNj75QRDcU/dbC6/QJ+gmdPIfIgrcByEnbMuZJ6Dt/B U/lylP1feJMC2TmFLkrlMKn4LNyfxmSxVlxAYVNOk8EYWoMpYnp+cfOsCzQq0W5Wgb7t LEEfX9PquNvFsuUoFCLlS22t4qaFTxSPfDXrN8q7qsWi2hGdr2Ndtn5ObbYMCO4WtREt V/NdYy3SX79JmSD8PVuy3apGsdsXW1pTnkHapLSXdPI3v7XvMGf8yOhFb3mPa9R6qxFi VAQyzf94/pgvYoeh+e1rCjGHOLr7JH87dQ/Hs/CyJ5f18+VRw/ducifYgCKTliXtKFEN fo8w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=rQRPqrFJ; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-159843-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159843-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id t10-20020a170902e84a00b001e3e56426e0si15097740plg.556.2024.04.26.05.16.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 05:16:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159843-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=rQRPqrFJ; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-159843-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159843-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 33EBCB21DA2 for ; Fri, 26 Apr 2024 10:15:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 47AE5143882; Fri, 26 Apr 2024 10:15:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="rQRPqrFJ" Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54C6013D53C; Fri, 26 Apr 2024 10:15:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714126503; cv=none; b=aJKXtkYEqm/3eoIKGPy5qU7iPTMP/o6V3zGIo4rgNr2ye0gc9gQelNsIQvXKwNz936IhjQnWlbwIK3R2D95J+qDP4G364vlV7iliEq+s1GvlBJayFlsfouJ3cAB5i2Ma3RQRsI1r/JzZDPu6hgOmKWbqI4MVcPyh7TdC1GMM/Dk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714126503; c=relaxed/simple; bh=ALcIRln45Y/G2JaG5UVvoiGMeRWE02AZbGsl22MTiPw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=l/9/1n9hxt2/RjG0s5/VLv7RzIikA0Kggq4oNMGO7CAzHSHGd/cLprtWXo8q/F4VR7opqcUiBHZEhnH3fvRB1IoZW1nWnmXwJYOi0gUUmnlxIKXiO+V62n5g5pYviEt8CsbTIgQuesFex8wMUtsG+1oFWnwcubbmkaMn1QSmg+A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=rQRPqrFJ; arc=none smtp.client-ip=90.155.92.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=ryVjswdoVqQB3NDQl33vADKSu7VWuONlL8jqOs+n9Sc=; b=rQRPqrFJRAj/wPN4+4jEVy5+g6 DkVhX3SxFUbWNnMCLhscqUhlHshGMr3IIXxvs1pePUypW+E/rp8SF6BTwgkeBbwi+Co0Pyoka4lG/ FUuaWXY8IsgUZynPjdIb+JmW1g9RmkcbF9V4hzEPJ5mCuAOFTWVupuig5rXp/EoHP/jeFBKNNqT9L C7b5b/b2wgVP8QbeuwNoNCa+ElthXH3shJKTuIruKaTJuIBTZwIrkMSyzay6LytNickkC4QhVbcgK NMQdK4Wfv5PzKS02/chz/QDtiA/MdrYTej0+wjIhkRghMu0qsTWHMderpRfW7qdfmof+oM3xwfIru 9l4U4qKQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0IbH-0000000FHLR-0ngO; Fri, 26 Apr 2024 10:14:39 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id C6DD63003EA; Fri, 26 Apr 2024 12:14:38 +0200 (CEST) Date: Fri, 26 Apr 2024 12:14:38 +0200 From: Peter Zijlstra To: Florian Weimer Cc: =?iso-8859-1?Q?Andr=E9?= Almeida , Mathieu Desnoyers , Thomas Gleixner , linux-kernel@vger.kernel.org, "Paul E . McKenney" , Boqun Feng , "H . Peter Anvin" , Paul Turner , linux-api@vger.kernel.org, Christian Brauner , David.Laight@aculab.com, carlos@redhat.com, Peter Oskolkov , Alexander Mikhalitsyn , Chris Kennelly , Ingo Molnar , Darren Hart , Davidlohr Bueso , libc-alpha@sourceware.org, Steven Rostedt , Jonathan Corbet , Noah Goldstein , Daniel Colascione , longman@redhat.com, kernel-dev@igalia.com Subject: Re: [RFC PATCH 0/1] Add FUTEX_SPIN operation Message-ID: <20240426101438.GA39183@noisy.programming.kicks-ass.net> References: <20240425204332.221162-1-andrealmeid@igalia.com> <875xw44fxk.fsf@oldenburg.str.redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <875xw44fxk.fsf@oldenburg.str.redhat.com> On Fri, Apr 26, 2024 at 11:43:51AM +0200, Florian Weimer wrote: > * Andr? Almeida: > > > With FUTEX2_SPIN flag set during a futex_wait(), the futex value is > > expected to be the PID of the lock owner. Then, the kernel gets the > > task_struct of the corresponding PID, and checks if it's running. It > > spins until the futex is awaken, the task is scheduled out or if a > > timeout happens. If the lock owner is scheduled out at any time, then > > the syscall follows the normal path of sleeping as usual. > > PID or TID? TID, just like PI_LOCK I would presume. > I think we'd like to have at least one, possibly more, bits for free > use, so the kernel ID comparison should at least mask off the MSB, > possibly more. Yeah, it should be using FUTEX_TID_MASK -- just like PI_LOCK :-) I suppose the question is if this thing should then also imply FUTEX_WAITERS or not.