Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp38057517rwd; Wed, 12 Jul 2023 02:19:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlF735Pg/bquTAGL67oaGZHEZEEwhibYab7WjqUyaQ4nWWA8lOwD/jEIr2rgR7YSxz0xWo2t X-Received: by 2002:a17:903:447:b0:1a5:150f:8558 with SMTP id iw7-20020a170903044700b001a5150f8558mr15689486plb.17.1689153559363; Wed, 12 Jul 2023 02:19:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689153559; cv=none; d=google.com; s=arc-20160816; b=D7zwDPX6n8NT+TPoVE20NHQo/DeX/8VF+ByMWyQUxKoz+4rCWOeDcjaBe8I3DD6uHh 4MWKYmq3bjPeAM9i1O8Iv/ZXRzBemFGKKUvvv5UOiNkBsucVc4c1tez5BXn716+nRG/A yiGbYjI22pg4UzrfeTZDMLMzwVHGNgMRzt2TRyh5Mrdfkccy2h0MaFb0ehFEZL5vYfsN j0k7EppgoNeGT6WtOc4YlPhuMukyjPPy1J6xZT0gQxW+L4/1NZypJYBhjgvjDrDwIKyW FSQWpLC+mP2Fw/6ZG9FIievA9yFBkKfmXXTyw9/pxcDeXIWGzUd587tgq+B1vBqebxD4 Jpmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=6vVyz3HWFOPsWCjVkQvhpKJWaNzacQU8pD7mOz5k2+4=; fh=YxoZzaFBzusEP422r4lluYPYJCJOrfINnL/9RtUT4Kg=; b=Yc3niHLAZLA+4pavHrMw64HnfL0VOZHhsNbDDIe+/BIDXLvlsu4NLf95fHA4LKuwdE qfkAhdTdsUXgn8/EF8PDf7B24zVErIru12FUX9AznXuEG3wS/bpU4McELVCeFFP/4dGp DgDiGUG4nhzkEq0DWHN9jK7iAo41UupiQjyEVXn8fk3WZ929kaCxo1NU6LrZqS2zxN65 VBXvraKc3i2p8XeSGe1NuIk1381+WKRjqJWH8565U5w8e+pew9QV85xIuJraeBCCD1be gGI5N33RnoNrmzKxJPhjMoPMrUhfq13LgaNwRDsHt/Ip+V/k8vJWJO4PGBay9n5Ga4Jk Ctqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=Ix8+Mtvk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m2-20020a170902f20200b001b9ea391af9si2805951plc.229.2023.07.12.02.19.04; Wed, 12 Jul 2023 02:19:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=Ix8+Mtvk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233059AbjGLI75 (ORCPT + 99 others); Wed, 12 Jul 2023 04:59:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232721AbjGLI7f (ORCPT ); Wed, 12 Jul 2023 04:59:35 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B86D01FDF; Wed, 12 Jul 2023 01:58:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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; bh=6vVyz3HWFOPsWCjVkQvhpKJWaNzacQU8pD7mOz5k2+4=; b=Ix8+Mtvk0Y/Rcjft+c4zuN08oD rMDNW7fFrce8cT8UDecBcnL/s1llRd2rN3LPwnmv6jKmpHWv8iyIyIga/5tzOK2ztg0kgmBt3H4Gp nWa7djDciJESbMPsigXIr3/OBlp8BCsrIovsMpbrLVNX4KWEuEpi/6XLCnvb5eF/wJghFHgq0G6Wo 6GH2I+anrpdCoxpnzkVumxX7z3+g4fpvi9ttrbQibRcX6w5ZEMWXxDKlLqgr8tKgwWtUb1ZJr1AMk GczvN3hJ0BiIkFzFXZ5a57WZSdpkXBJ8UgMQYCQHn1gOAGD8D4I6I0Nx9yEg0Hb61RhtYPwqCxdIb K8vcxY0A==; 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.96 #2 (Red Hat Linux)) id 1qJVfg-003bI1-2C; Wed, 12 Jul 2023 08:58:04 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id CC12230114F; Wed, 12 Jul 2023 10:58:03 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id B1979243AF2B7; Wed, 12 Jul 2023 10:58:03 +0200 (CEST) Date: Wed, 12 Jul 2023 10:58:03 +0200 From: Peter Zijlstra To: Jens Axboe Cc: io-uring@vger.kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com Subject: Re: [PATCH 2/7] futex: factor out the futex wake handling Message-ID: <20230712085803.GD3100107@hirez.programming.kicks-ass.net> References: <20230712004705.316157-1-axboe@kernel.dk> <20230712004705.316157-3-axboe@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230712004705.316157-3-axboe@kernel.dk> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 11, 2023 at 06:47:00PM -0600, Jens Axboe wrote: > In preparation for having another waker that isn't futex_wake_mark(), > add a wake handler in futex_q. No extra data is associated with the > handler outside of struct futex_q itself. futex_wake_mark() is defined as > the standard wakeup helper, now set through futex_q_init like other > defaults. Urgh... so if I understand things right, you're going to replace this with a custom wake function that does *NOT* put the task on the wake_q. The wake_q will thus be empty and the task does not get woken up. I'm presuming someone gets a notification instead somewhere somehow. I might've been nice to mention some of this somewhere ... > Signed-off-by: Jens Axboe > --- > kernel/futex/futex.h | 4 ++++ > kernel/futex/requeue.c | 3 ++- > kernel/futex/waitwake.c | 6 +++--- > 3 files changed, 9 insertions(+), 4 deletions(-) > > diff --git a/kernel/futex/futex.h b/kernel/futex/futex.h > index d2949fca37d1..8eaf1a5ce967 100644 > --- a/kernel/futex/futex.h > +++ b/kernel/futex/futex.h > @@ -69,6 +69,9 @@ struct futex_pi_state { > union futex_key key; > } __randomize_layout; > > +struct futex_q; > +typedef void (futex_wake_fn)(struct wake_q_head *wake_q, struct futex_q *q); > + > /** > * struct futex_q - The hashed futex queue entry, one per waiting task > * @list: priority-sorted list of tasks waiting on this futex > @@ -98,6 +101,7 @@ struct futex_q { > > struct task_struct *task; > spinlock_t *lock_ptr; > + futex_wake_fn *wake; > union futex_key key; > struct futex_pi_state *pi_state; > struct rt_mutex_waiter *rt_waiter;