Received: by 2002:ab2:3c46:0:b0:1f5:f2ab:c469 with SMTP id x6csp157015lqf; Fri, 26 Apr 2024 02:44:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXFYUxEK4YSEmzY4PLSWEVf0AtOQn+mDiPTK3jWeqFRsGsl/uTvaRhFQe289irtEG+ZRII0JzAbBUubOIj4qmRUEjv/taP/O3wpcL/p4w== X-Google-Smtp-Source: AGHT+IGBC89Ou/XzzEbzgD6WlNil/u2KLjo2UZg4/iXDLdZp5tnfLNfPAIK7fjLcBTi/WxLcmutx X-Received: by 2002:a05:6808:e85:b0:3c8:2b8e:6982 with SMTP id k5-20020a0568080e8500b003c82b8e6982mr2829314oil.18.1714124662193; Fri, 26 Apr 2024 02:44:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714124662; cv=pass; d=google.com; s=arc-20160816; b=v92ldBuDMUR2oJgoehjoLU5kX3avKOWNKzn1tYwvJykhOEhsz8dNaxuQyxBYZOdhLS eld6ElTuIRnwZRgumUbSZ6H3CE86NCHD5dIbYypZ5hAyrI7Y63TI5hrB+N+kk6HIe8tK ZOFuNwlT9NX+EkABzxjiX2ARZsrhgykApINZbcnnemYkU0wN4695jkQT2v0jYs8nF76i YUVCr4AIUDnv9FLZUSHKSSxEfempWxwOCBDQxzWQDz1VPxsE7wwBCsmreX6KjDjlL3CE 0imvwTApZmQ8Za60qogF+hVyEk5CGg/G+haVDTAfxO+lCV8IZSlU8Nu9p7cswPFh7Vkv xfwQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:dkim-signature; bh=ThRbfX0S+BKG7HsDfQ7j+bHT6F0CY2NaaiZlfhtWgy4=; fh=TW36hA5F7zpW/sc1EupO3HzdY4NU4M/oEU0SzSM2Ky0=; b=eokueU8Zn/p5m0VQXIrbc37TODEh11jSQIeArODYQDHUfNDWVb/e/ZWjbMttKFPVDC NN8GxLZIR2u129UzSbZXTIBhlMRy0IfCqpIMqvFolcxdsYpDgF2A+YCOTo23D22miVdW pztfQBHeo+r0TeELVihCAf2yLSrGAyE72WWQEgYmLXuuTCfXNeJpfgoNwoJ75n+hdQbL oLZhMrYkacCNepnSnE7oLiXMQmFm7H0zb64DCkIF1mGYgIsDJLILKn8eHmQntNkDyxnb hTYjR2BlSar1t+YCPTxmldn/bacqdZSJ+utZiPR1a5j9CBAaTiQ/U1MAaQkepWBVE7Hn JUCg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UHliov4X; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-159808-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159808-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id g20-20020a635214000000b005f057f31f96si15048706pgb.60.2024.04.26.02.44.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 02:44:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159808-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UHliov4X; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-159808-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159808-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 8826A28559A for ; Fri, 26 Apr 2024 09:44:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6EC5113F453; Fri, 26 Apr 2024 09:44:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UHliov4X" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 6505A13F425 for ; Fri, 26 Apr 2024 09:44:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714124650; cv=none; b=GBBsQ7lwz5fcCKdLv4wpIA0R7FKgiEwYR/gIUqNprjF5qeSs2XHA8Y54imLSH/BIiHFMGG+XxROQmNSM1kYQyyz9tPgvs+EQwADtIOtjf+RqI22pZc88/PV1vRJt41tn+68GeA50KcQTPdW77hqv+ZL8/wZO1fWNe5gSvTPucLk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714124650; c=relaxed/simple; bh=pmgilF8ToQ+8ZjQbwsCILaNYDi9BiJ0128c5TJVmOaE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=Uy+UffYjPaJFhXx4hhXZHmz/CHd6Q7WtSdH1iuCJX0l6CYmWW95vm0rvdKnJvPY8WyrYoUASrwdyjQJMH9vL/qKmKikZyv9Ob0DnpjbRH3lX83L1CAGt16cqzH1f9dBqsJMDjwhLI6LTj080IMFEWxDUtPaY+5yyJFB3gRikFWg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=UHliov4X; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714124648; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ThRbfX0S+BKG7HsDfQ7j+bHT6F0CY2NaaiZlfhtWgy4=; b=UHliov4Xq4PgDS/6KxfPPSgX/ybwqUCwJm5FdjtvlDoJlWbSsa+qEnPqKRWbEJW9s6hhqc gJkLQUFChyLUP4sNmJZ8RKwnB6NHGJS0nz/2jApphIZOpNMdsytOJ6XE/hGc8/rpnEbvYL BkmRYiKJtsTXotJBSK5qUJGjCfkdl8A= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-467-thNNxvOKOA2akbY9q6qn5Q-1; Fri, 26 Apr 2024 05:44:00 -0400 X-MC-Unique: thNNxvOKOA2akbY9q6qn5Q-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 827D73803916; Fri, 26 Apr 2024 09:43:59 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 58CA840C6CB2; Fri, 26 Apr 2024 09:43:53 +0000 (UTC) From: Florian Weimer To: =?utf-8?Q?Andr=C3=A9?= Almeida Cc: Mathieu Desnoyers , Peter Zijlstra , 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 In-Reply-To: <20240425204332.221162-1-andrealmeid@igalia.com> (=?utf-8?Q?=22Andr=C3=A9?= Almeida"'s message of "Thu, 25 Apr 2024 17:43:31 -0300") References: <20240425204332.221162-1-andrealmeid@igalia.com> Date: Fri, 26 Apr 2024 11:43:51 +0200 Message-ID: <875xw44fxk.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) 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=utf-8 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 * Andr=C3=A9 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? 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. I haven't really thought about the proposed locking protocol, sorry. Thanks, Florian