Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp104223pxb; Tue, 29 Mar 2022 00:38:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6m3p39TS2dqUC9RDEfwP+ahTb1K0yXQJr121HKNg4w8luUAwBDfm92iVnasO9zzYhsvHm X-Received: by 2002:a63:4859:0:b0:381:ede3:9af0 with SMTP id x25-20020a634859000000b00381ede39af0mr1088964pgk.87.1648539488814; Tue, 29 Mar 2022 00:38:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648539488; cv=none; d=google.com; s=arc-20160816; b=m6Yr60ny+IFfHGXydUuBaIeO0wgqdkICVtxvjXpMxqQwFJkyIDDWMbO9RESqNIavm4 dpNpp6B3VkN0DMrzIp8w6nM23+DAAyO72Ok7HpZFxlWUQhZKFoqVwR24icaJCW0DwFSB 2e+MEsCB5YCB8nonoePhYU2swOMSNA/TkRqC1c3PJEJTfYx9VZQAbWbC7O1vD9RYjHbG NMPs70k9CMoYiUGU3ZSp4Y/XKmYb46uIjRLx1Dd8UvToMwRROwfoHKuF+j0YLqW4IJar U2Mgypqy8PDqcsmlYPQOJVod+s32FDx57x272TX8lgRkmJRhtfNnwlccGGjPC3DAcyRV bZvg== 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:dkim-signature; bh=W1y47fruuz1adMoGsmGguCChQgPERRZ/eZEaS/9tiao=; b=s4T+K2X44yY5Ms3mn9BVENAIDMg8G0KDar+z+BzD8IZcghMLnwr2ducyLNEOtbjM5s RPzdhwiGY8OoWe1Ymvzx1Q88eVsAbIDKQBao6+EJmOAAo8GB7QhhMOxOkeWTmQBpxTwY 5fEr9hK82WGGvURKYfzhmtl8EV5JuTYfnRTQJj25f1cS72ziQnrCy7errMUZV3YaarUo V0qfO698nBp/rrubGMpG0PtZvbHkSoR0VOa6cdeqx593HD47VIw+IK5SLeqnJFBhSnW8 FU1lk8yIH038fmWfENqlFQPPyrSzOy4XMKzddO34mm8Z7SiiDIWZj9kGsftp2lq/Nipi GS5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Oirsx8j1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s18-20020a656452000000b003816043efcasi16037509pgv.447.2022.03.29.00.37.49; Tue, 29 Mar 2022 00:38:08 -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=@intel.com header.s=Intel header.b=Oirsx8j1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232144AbiC2FS1 (ORCPT + 99 others); Tue, 29 Mar 2022 01:18:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231225AbiC2FS0 (ORCPT ); Tue, 29 Mar 2022 01:18:26 -0400 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC59B181B0A for ; Mon, 28 Mar 2022 22:16:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648531003; x=1680067003; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=QeNE9/gtPkar92U7I/guWUxoEyBuRFRr0c1TASY7eBg=; b=Oirsx8j1JtjCOtvGiEmvF1Mw0O5Z0hxNx8PxhhkFgAQcSvUEuSa3nLPY JBaAKuk9UFkJtlyimaRSgim1XF+JWdolXeNhZrqDQQelpkhMo1+HKSU8V 5S+EFLxhtPxTI5NuHhVtOpRcec/lboL4JS19nonU2vmDpQspG9GOmLF4q 6h3+7YZdseB0W4pNC9+2B4YxFETFMoYW51mpCgtDERLTHzMZ+wY1iLs4f xez+KaghlAhEGnDb9zMsjU/4qyQEdOn+qEgISqnR+l5qWqzSBVZgYOjx+ 1U4CtkxbIerhELrwsoDjBmgcAZnhrdPKHgXHKNLoneeKssCnACpKj2ZrN A==; X-IronPort-AV: E=McAfee;i="6200,9189,10300"; a="319863447" X-IronPort-AV: E=Sophos;i="5.90,219,1643702400"; d="scan'208";a="319863447" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Mar 2022 22:16:43 -0700 X-IronPort-AV: E=Sophos;i="5.90,219,1643702400"; d="scan'208";a="564313639" Received: from zq-optiplex-7090.bj.intel.com ([10.238.156.125]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Mar 2022 22:16:41 -0700 From: Zqiang To: tj@kernel.org, jiangshanlai@gmail.com Cc: linux-kernel@vger.kernel.org Subject: [PATCH] workqueue: Restrict kworker in the offline CPU pool running on housekeeping CPUs Date: Tue, 29 Mar 2022 13:17:14 +0800 Message-Id: <20220329051714.2184811-1-qiang1.zhang@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, 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 When CPU going offline, all workers in this CPU pool will lose affinity to this CPU, and may run to isolated CPU. like kworker in unbound pool, set CPU affinity of these kworker is housekeeping cpumask. Signed-off-by: Zqiang --- kernel/workqueue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index abcc9a2ac319..c509ce73a783 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -5023,7 +5023,8 @@ static void unbind_workers(int cpu) for_each_pool_worker(worker, pool) { kthread_set_per_cpu(worker->task, -1); - WARN_ON_ONCE(set_cpus_allowed_ptr(worker->task, cpu_possible_mask) < 0); + WARN_ON_ONCE(set_cpus_allowed_ptr(worker->task, + housekeeping_cpumask(HK_TYPE_WQ)) < 0); } mutex_unlock(&wq_pool_attach_mutex); -- 2.25.1