From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id E8EC43858C42 for ; Fri, 26 Apr 2024 09:44:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E8EC43858C42 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E8EC43858C42 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714124648; cv=none; b=fEewEDK4m99UrjafJY8JLs3FyveqM5uteb1Hl6be0VANlqyfsPFfFcqITXS3URL1rovAkA7zTCuch8ngIsOBeaK1P1K7HvhSieLcwTzKFNcVkYpv/HXSdiVt5RBbkGdpCBU3OfjOuJoYq4B1Oy+9TWPdMKQxEAsCFkMHT5g5zug= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714124648; c=relaxed/simple; bh=pmgilF8ToQ+8ZjQbwsCILaNYDi9BiJ0128c5TJVmOaE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=BjK/PSzt24YMlevq+WzTgJ2eM3z+bguT1P6V4vC5UqgbG7kJatQmImnB+YLZuAzk01Oy3R7Fk90XRMj74ZG1c3a1R3XsQzPMpfo8vaLf5x059VnhNEhYMxuPQuB+/2U/PYpvMl8ElNftj45RB2GbAlTqiomtvaikIQ22HxIwrbA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714124646; 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=YTSKVhqqIx7kKvg+jMj2cnyvco23V0I+QAilqxioORPxXCHV1UnG/RoPP5pOIZo5PWJu+P /AZfJV7iRWw63aTSwSAmNoNYbd1SNf3yAPkDNFcyXqx2yxzra7GXZfEjE9EzQ3NNHpoldk VEX7+7f220MlHfZmjxRAFy7Q5pmprgc= 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) 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 X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: * 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