Message ID | 20230807220637.3203739-1-atomlin@atomlin.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp1759191vqr; Mon, 7 Aug 2023 16:02:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHX5RYKNRYrre+rFut352HgB8WkdlzanrNaDejki8YsTS0v2CxVeN3Y7izXIQ1yz24ToOyf X-Received: by 2002:a17:90b:4f48:b0:268:b64b:f684 with SMTP id pj8-20020a17090b4f4800b00268b64bf684mr9640995pjb.33.1691449364260; Mon, 07 Aug 2023 16:02:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691449364; cv=none; d=google.com; s=arc-20160816; b=T8yrkhFWQpgkEg22GtPGf0o+B1LRUnp5SOCFVE1VhJRl2Gb+IFLArmPcReLfA1QvAG uXEBB7prt9ukyXXs1PZWh9dor5+DMOOYQ4vg5xq7wHsM52e0EB8Rei2NURgdm8OuEH2D o0UVPhfMcGEf5OQGAYIQN3PBMm4QiQtqaJ7BdsM3tud+r1opUg2jcamCRo3SoZhnCNQt SpNURlS7d8BL8gkmGzJsyljkRuTUnTOtLoTaPQJjiIi2DJFUnIXvnAZaIk9HqN6+NhGd p/zGr1WpZ2fEKsXKTWJ0DEBhTEKV/iK5O9iaoNWQJhGIl/p3OFWeN+jO8BhYxgmzxgfj 9TWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=w5zsRw//Fc4hQsDLFaCEkHGCWD8K+hgQkIPRII2um8o=; fh=a/8srlCr7ZuOL9dLHhjXr33NcJQCC9LdC4rl4ej/yQI=; b=jD9LNqVwsknO40uatAwj10RoT4Mh73jbDfJzyef3AhKPZOwmLh5y7+t5yfl1kIiCvR yH7UMPF1R4NrW4UgNhq+9FBZlefbGHgmlRzAwkPrM0EmAxyaGzgLN+CjHfulC9dJf6/g SB3ZEhapN2KfK6igvskAZWjKN/l7wZBbA02HCF1sbRIwpPtyniVKTmIDCQ074o90Kb75 +xOi/YgFdcSgrMmxOlm0Nyk34g8RbzZW53FOt58G7E5kmOtcNiYwi8VdNxsJQgAZwun5 clnUwzqxtUVJenTLJRUnzZAUFywwRxS/Zt7cqG/AiNawvlJOUmMMyasYqOTFMadWEoUJ 4PFw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hf17-20020a17090aff9100b00262e3c1c1efsi6521233pjb.79.2023.08.07.16.02.30; Mon, 07 Aug 2023 16:02:44 -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; 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 S231261AbjHGWM0 (ORCPT <rfc822;aaronkmseo@gmail.com> + 99 others); Mon, 7 Aug 2023 18:12:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231251AbjHGWMN (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 7 Aug 2023 18:12:13 -0400 X-Greylist: delayed 210 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 07 Aug 2023 15:11:10 PDT Received: from p3plsmtpa13-06.prod.phx3.secureserver.net (p3plsmtpa13-06.prod.phx3.secureserver.net [72.167.218.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71A372116 for <linux-kernel@vger.kernel.org>; Mon, 7 Aug 2023 15:11:10 -0700 (PDT) Received: from localhost ([82.27.99.45]) by :SMTPAUTH: with ESMTPA id T8N3qcRyBSo81T8N4qaX53; Mon, 07 Aug 2023 15:06:39 -0700 X-CMAE-Analysis: v=2.4 cv=WazKKWtX c=1 sm=1 tr=0 ts=64d16aef a=YwMIiW7BGddQzL8MrqPWMg==:117 a=YwMIiW7BGddQzL8MrqPWMg==:17 a=j-LfP5YGAAAA:8 a=FPoep68dpx1dqRdUuF0A:9 a=pci6KG57UX3UzFLC8IW4:22 X-SECURESERVER-ACCT: atomlin@atomlin.com From: Aaron Tomlin <atomlin@atomlin.com> To: tj@kernel.org Cc: atomlin@atomlin.com, jiangshanlai@gmail.com, linux-kernel@vger.kernel.org, peterz@infradead.org Subject: [PATCH] workqueue: Rename rescuer kworker Date: Mon, 7 Aug 2023 23:06:37 +0100 Message-Id: <20230807220637.3203739-1-atomlin@atomlin.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4xfFo1C2Z9MFQIaTePl+WZBSY4ik/ke84/WMSJuqTXrhMD0BDb4rJsX1iSVy1HfdPpEWL9ywDIIro1zi7IRVVcWBF7cAGQyY1R/0f/I28llA74/e9Hrvnq RClOc8bz9QWCAPC/Y/zC1bIO+mqEgxifew4NWMuxtTgsv2OH4K8pWKaLqUGHw30r/Q4/vidsyIt3X1KECzZGw46l7t4zh8OS/e7fQ6EZm3vejMsa9aND8ydr PfT3emNoUeTwNbtlwnixJWfN4vxwX8dvOW2N4FjHo6wgsBy7XG7tNEd8ne9OLQoMl17GnQgallEKZ1PWxJJ7Xg== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773613208502499568 X-GMAIL-MSGID: 1773613208502499568 |
Series |
workqueue: Rename rescuer kworker
|
|
Commit Message
Aaron Tomlin
Aug. 7, 2023, 10:06 p.m. UTC
Each CPU-specific and unbound kworker kthread conforms to a particular
naming scheme. However, this does not extend to the rescuer kworker.
At present, a rescuer kworker is simply named according to its
workqueue's name. This can be cryptic.
From the context of user-mode, it can be useful to identify a rescuer
kworker since their CPU affinity cannot be modified and their initial
CPU assignment can be safely ignored. By design a rescuer kworker can
run anywhere and only processes work items in an emergency situation.
This patch modifies a rescuer to follow the kworker naming scheme.
The "r" and "-" is indicative of a rescuer and its workqueue's
name respectively e.g. "kworker/r-ext4-rsv-conver".
Signed-off-by: Aaron Tomlin <atomlin@atomlin.com>
---
kernel/workqueue.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Mon, Aug 07, 2023 at 11:06:37PM +0100, Aaron Tomlin wrote: > Each CPU-specific and unbound kworker kthread conforms to a particular > naming scheme. However, this does not extend to the rescuer kworker. > At present, a rescuer kworker is simply named according to its > workqueue's name. This can be cryptic. > > From the context of user-mode, it can be useful to identify a rescuer > kworker since their CPU affinity cannot be modified and their initial I'm not necessarily against the rename but you can't, or at least shouldn't, modify the cpu affinity of any workqueue worker. You don't know what that worker is going to be executing even at the moment when the cpu affinity change is committed, let alone in any future. Can you please drop that part from the patch description? It doesn't make a lot of sense. Thanks.
> I'm not necessarily against the rename but you can't, or at least > shouldn't, modify the cpu affinity of any workqueue worker. You don't > know what that worker is going to be executing even at the moment when > the cpu affinity change is committed, let alone in any future. Can you > please drop that part from the patch description? It doesn't make a lot > of sense. Hi Tejun, Understood - will do. Initially, I wanted to stress the point that user-mode should not pay any attention to a rescuer kworker's CPU affinity since by design it can run on any possible CPU. According to housekeeping_setup() and workqueue_init_early(), if I understand correctly, when kernel parameter nohz_full is set then each unbound kworker is not permitted to execute on any CPU in the specified range i.e. the unbound workqueue cpumask is set based on the housekeeping cpumask only. So, that's good enough. Kind regards,
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 02a8f402eeb5..d9bb375b8d02 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -4599,7 +4599,7 @@ static int init_rescuer(struct workqueue_struct *wq) } rescuer->rescue_wq = wq; - rescuer->task = kthread_create(rescuer_thread, rescuer, "%s", wq->name); + rescuer->task = kthread_create(rescuer_thread, rescuer, "kworker/r-%s", wq->name); if (IS_ERR(rescuer->task)) { ret = PTR_ERR(rescuer->task); pr_err("workqueue: Failed to create a rescuer kthread for wq \"%s\": %pe",