Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1897364pxp; Thu, 10 Mar 2022 14:33:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJxFGl3p8VF8B8nfJsnYXvOz5TT4NlmnV+f6sRIzGQHZ3IUTiHjzFbxC9qD4pdzVVN4IYvzG X-Received: by 2002:a05:6402:34d6:b0:416:c66d:96b4 with SMTP id w22-20020a05640234d600b00416c66d96b4mr2791722edc.65.1646951601440; Thu, 10 Mar 2022 14:33:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646951601; cv=none; d=google.com; s=arc-20160816; b=dbUz7DmfrhPxwNJOe8DT2PL7y1dbO+XbSEZy8jR3Vc5i/4uWW/Er+NHn/PnqvSIu+k LiA51GepUdM4G5kjDc/fbQh0QK9nKCKHn/jjHrYfkoNLTAQFmMetClcI3Wna83K24gAf gjVWeHYE5nLSxl5gBnMet91Sibvg4+LW6+sGby/Rhw+1wv0nKfikE7nSs4n6r4n3uj04 VDdmMWEhgqr9Ed79lk9Eva5e7kuU6Avy8tUw6OOy/fhePh67W3LD70O7mDmawDJ5HpzO AZuBnJVq10W9vkKQUsYTmUf/VB2FIvKnVFoNGJ8TbATv3u+qvpaMDeaGoAXmUNJ5L9TK zrGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=Zfu3ehkw2+nEPkH//HDgSybpr38Qr9p9fpc+1N9+gKY=; b=lJdulqr1kEl8MX7sE3M3VxoMDSoG9qdrv5M0eXCydCjYhBSQXwiyjWP5LS9nLMEbWk FE9EbOBdkBOFVb+F4YUJFa5yBB2oAoDKoEEHCFTNI3QdRFCRAVDwgpNX89L94JmtOfGo D7dhXCxvcrlLEzPgabzwtTE1hvqL04j6ktswxNb32YhGfrlh6xBJYW/LCLxhd6BS2HTY ZqkT2OelQ5WfN8btJDcFBXr+DWCT1bzl2XEaV4IYer3kbcq5bLEpT8+jv44fXpmhSn8r AqhImO4dsawpWxcuQNLG2vUy1v6P7kF4WYydLUjT2qhDL3ozHhLxZl/Rj6bQB+xHoEff BuTg== ARC-Authentication-Results: i=1; mx.google.com; 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 d7-20020a50ea87000000b00410b60d95d9si4335497edo.271.2022.03.10.14.32.58; Thu, 10 Mar 2022 14:33:21 -0800 (PST) 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; 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 S245252AbiCJOjU (ORCPT + 99 others); Thu, 10 Mar 2022 09:39:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343855AbiCJObZ (ORCPT ); Thu, 10 Mar 2022 09:31:25 -0500 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C3FAC6261 for ; Thu, 10 Mar 2022 06:27:40 -0800 (PST) Received: by verein.lst.de (Postfix, from userid 2407) id B305468B05; Thu, 10 Mar 2022 15:27:36 +0100 (CET) Date: Thu, 10 Mar 2022 15:27:36 +0100 From: Christoph Hellwig To: Jens Axboe Cc: Christoph Hellwig , linux-kernel@vger.kernel.org Subject: Re: [PATCH] task_work: simplify the task_work_add() interface Message-ID: <20220310142736.GA1103@lst.de> References: <20220223072754.616027-1-hch@lst.de> <58c5f828-df7d-6698-e2d6-2a869e134dd4@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <58c5f828-df7d-6698-e2d6-2a869e134dd4@kernel.dk> User-Agent: Mutt/1.5.17 (2007-11-01) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Thu, Mar 10, 2022 at 05:43:25AM -0700, Jens Axboe wrote: > On 2/23/22 12:27 AM, Christoph Hellwig wrote: > > Provide a low-level task_work_add_nonotify interface that just adds > > the work to the list and open code the TWA_SIGNAL and TWA_NONE callers > > using it. task_work_add() itself now only handles the common TWA_RESUME > > case and can drop the notify argument. > > Not sure this is much of a cleanup, and a potential fast case of > TWA_NONE will now still still set TIF_NOTIFY_RESUME. Also: No, the old TWA_NONE case is switched to task_work_add_nonotify and does not set TIF_NOTIFY_RESUME. > > > diff --git a/fs/io_uring.c b/fs/io_uring.c > > index 77b9c7e4793bf..94116a102dc61 100644 > > --- a/fs/io_uring.c > > +++ b/fs/io_uring.c > > @@ -9606,7 +9606,7 @@ static __cold void io_ring_exit_work(struct work_struct *work) > > ctx_node); > > /* don't spin on a single task if cancellation failed */ > > list_rotate_left(&ctx->tctx_list); > > - ret = task_work_add(node->task, &exit.task_work, TWA_SIGNAL); > > + ret = task_work_add_nonotify(node->task, &exit.task_work); > > if (WARN_ON_ONCE(ret)) > > continue; > > This one is now no longer setting TIF_NOTIFY_SIGNAL. Yes, this was a rebase bug. > If you want to get rid of the argument, why not just have separate > helpers? task_work_add_signal(), task_work_add_resume(), > task_work_add(). Setting TWA_RESUME unconditionally because it's the > common use case doesn't seem ideal. In this series, task_work_add_nonotify is what you seems to call task_work_add, task_work_add is this series is what you call task_work_add_resume and task_work_add_signal is open coded because there aren't a whole lot of users. But if you want I can add task_work_add_signal and rename task_work_add to task_work_add_resume, but I think keeping the task_work_add_nonotify name for the low-level helper is a lot more descriptive.