Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp2448108rwb; Sat, 29 Jul 2023 07:05:37 -0700 (PDT) X-Google-Smtp-Source: APBJJlGtMhEcac3hgqmOB9TP3CCwzVPcZSCQa8J6R965XunQTrLhqVqsRHpMnyx1bo25bPHLGLHq X-Received: by 2002:a17:902:a705:b0:1bc:2bd:8520 with SMTP id w5-20020a170902a70500b001bc02bd8520mr546406plq.6.1690639537508; Sat, 29 Jul 2023 07:05:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690639537; cv=none; d=google.com; s=arc-20160816; b=SLHeaG08iuU0+RkbnPYWASNN0QCtY9f3KbENxzamSf+I6mmYZTGnEGbr/12wHNgdRZ y4BHYGgrxSTLRdBE2b7e96CR/KFY0S/DPm9Igs4p2qbKHnwxSBg2Kn32FOJ6WhBFD18I 4yasOtSxORMh4pjtglPqj88LM0K7+DbZCtkbKvEmf12npxcRtQNnnreWsNn9scuN8WAV MyF7kf1vLaFe4Ay9rgV9yma/bs26hDFnm2o7uFnI3D8J2m7Mvwz1tzW0JOA8ogngPBfX 7bjIlUamLf9PelnexlIqVQN1o8qvA4wVHPUPE89BWhUc8EMMf29brAKnJzfwDTEvNL94 1N4w== 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=ItceX9cDOozwZpHaz0SKD4GPoPizIK47y64sO6xriYE=; fh=iIrmuiooHb58lVSZg9OlpW7yJYF2kt3Km03sQ9AihSM=; b=q+YZ5lMuzcJItu2Xg02Pmo+ZQHckX2H60vTc7g7QoufN/hPeMVpzlVQJ/PMBtehRmC TJGy7o2OCeKyqSyXncuGCpSPjZcsb3laDO3wlhpkbe3x+txD6i7b/X0UzAjTlOLP9qkW aQuS0EypDAPi50FfKp9xRVYLQBFp1wivKjaQqOAIxE69v2vm3jrmmFfQPL6MLBL2FQzO A2DPQaleVv3pRbACIPSfjfKxng0CDo0D6bN0vrO7oPzVZ0QJOByPB2UvFwcAjzjEKDJ+ +Mqc/OpflcSpVGoEkG4GxhYfYl/bSclwvHuPA1Wq82qtewhkQtvxd8exAnHxMjMyZdWm 3PzQ== 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 p4-20020a17090a348400b0026800178358si4723775pjb.144.2023.07.29.07.05.25; Sat, 29 Jul 2023 07:05:37 -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 S231590AbjG2Nz7 (ORCPT + 99 others); Sat, 29 Jul 2023 09:55:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231491AbjG2Nz4 (ORCPT ); Sat, 29 Jul 2023 09:55:56 -0400 X-Greylist: delayed 135 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sat, 29 Jul 2023 06:55:52 PDT Received: from p3plsmtpa08-03.prod.phx3.secureserver.net (p3plsmtpa08-03.prod.phx3.secureserver.net [173.201.193.104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A8AA1FE7 for ; Sat, 29 Jul 2023 06:55:51 -0700 (PDT) Received: from localhost ([82.27.99.45]) by :SMTPAUTH: with ESMTPA id PkNyqM7LIgssUPkO0q93dq; Sat, 29 Jul 2023 06:53:36 -0700 X-CMAE-Analysis: v=2.4 cv=XoY8e3J9 c=1 sm=1 tr=0 ts=64c519e0 a=YwMIiW7BGddQzL8MrqPWMg==:117 a=YwMIiW7BGddQzL8MrqPWMg==:17 a=Qe_DDWJ2S8ZzKdoxMNcA:9 X-SECURESERVER-ACCT: atomlin@atomlin.com From: Aaron Tomlin To: linux-kernel@vger.kernel.org Cc: tj@kernel.org, jiangshanlai@gmail.com, peterz@infradead.org Subject: [RFC PATCH 0/2] workqueue: Introduce PF_WQ_RESCUE_WORKER Date: Sat, 29 Jul 2023 14:53:32 +0100 Message-Id: <20230729135334.566138-1-atomlin@atomlin.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4xfDm+ivhAG0siGQTlgWZ1nlzf+D2vp9U5BHNoR4ign5AtO7ygzgpr0Kj+Jq+BWNQ+RDj0fqB6LRpM0Eqaz55G37n+b/tU2V/lbJmSVFWagz8RscjdS5gf cWe+dbF5uKU+Non476fA6AHoiT1FqbOKj3ufRfnirk5UMvRFhSIC7mLBFOVbT+1tfKTrB6clDUSYj8DKi+RH2/VHi0bZVQt4StwBdVCjaFqDeAShb6E27Gqx ZaHGqvXV/v77Zx6M2dOlyZKYgYqwF8ZipH0Kf1QJhAc= X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, 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 The Linux kernel does not provide a way to differentiate between a kworker and a rescue kworker for user-mode. From user-mode, one can establish if a task is a kworker by testing for PF_WQ_WORKER in a specified task's flags bit mask (or bitmap) via /proc/[PID]/stat. Indeed, one can examine /proc/[PID]/stack and search for the function namely "rescuer_thread". This is only available to the root user. It can be useful to identify a rescue kworker since their CPU affinity cannot be modified and their initial CPU assignment can be safely ignored. Furthermore, a workqueue that was created with WQ_MEM_RECLAIM and WQ_SYSFS the cpumask file is not applicable to the rescue kworker. By design a rescue kworker should run anywhere. This patch series introduces PF_WQ_RESCUE_WORKER and ensures it is set and cleared appropriately and simplifies current_is_workqueue_rescuer(). Aaron Tomlin (2): workqueue: Introduce PF_WQ_RESCUE_WORKER workqueue: Simplify current_is_workqueue_rescuer() include/linux/sched.h | 2 +- kernel/workqueue.c | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) -- 2.39.1