Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp164831imn; Fri, 29 Jul 2022 03:19:32 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sfrXyeI6bof6tTSGv81EhfyMCkWD/c8WaUdxT6ubRgS2axb89NdjP+anEj6jLB/21DgqLU X-Received: by 2002:aa7:db87:0:b0:43b:a0d5:8848 with SMTP id u7-20020aa7db87000000b0043ba0d58848mr2899540edt.60.1659089972597; Fri, 29 Jul 2022 03:19:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659089972; cv=none; d=google.com; s=arc-20160816; b=XMD9t16V1Lm1Epuh3ijRVBTQvQovoSylaneXSrPZU0Vd9EnpR7HiUm8l5ydqxJV44y 5vovcXTFB3AmBgyOrxghE90kgYTZnKRdWd6FmLAys1xQH6wb4boABnxnBZ/Derw35IjO yCZlFheh3pY6bZbPhi5bW6xobpRpPc2qJohr96AZ4sKMXJ/9nwrnP2AwGMIr2TwIAthu 1RwFQ6iAp6CTA8Z5EbaWXAPvCSz7HUkXqVfDrzayou3HfXSJTcAWjsMIcf077mWLn4BT ovFHnV0cEOdiMWEhiiCnO0f7WybZZulfXaPm1aWRfXV5J2pNbzSgbvGaqDm+0t4E9JdT Uqkg== 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=dryKzknTwjOf+VunOu1ss5DcnVHNtdSKVmRMmz8L7/M=; b=0Q58eoW1Xc17+uFRS5F6UhzzAdukDuicFm0IPqlu/K+7qV66DVJuOLUDrD88hoOFrH dDIkpeF/sPwkzvMNfygjRKqur/aFhzPvBNI3ORT/j52zli+knPauCqrqvauMQ4ZazZQ8 LqBq+U8oNXH7GdeBBNvrcKxvmRHjf7t2qhzbW/y8VtQHDEEb/+pE66fKjy4BwjI79M50 5pBstCWpfRVHGqsVMCKXMRsPrhXck2zxK5s8l+JQVU6jgsMcfROYfrQ3i81cinPC6yXP YhiCeid5AYAXfre3pQAHyALvtqN+1rIWfjAdwB5mco+x8R4ee3Sk7MKC/BC9PwjcXH1N TGiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RmegUcAa; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x5-20020a056402414500b0043bb8c45f26si2867816eda.128.2022.07.29.03.19.08; Fri, 29 Jul 2022 03:19:32 -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=@gmail.com header.s=20210112 header.b=RmegUcAa; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235455AbiG2Jnt (ORCPT + 99 others); Fri, 29 Jul 2022 05:43:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233605AbiG2Jnr (ORCPT ); Fri, 29 Jul 2022 05:43:47 -0400 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F13C1F5 for ; Fri, 29 Jul 2022 02:43:44 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id s206so3623505pgs.3 for ; Fri, 29 Jul 2022 02:43:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dryKzknTwjOf+VunOu1ss5DcnVHNtdSKVmRMmz8L7/M=; b=RmegUcAao+BR1SjifamXxiAd7dUw4XR+bu86vHq/s/P/1pGQSqeuT4SW8+0IaFNX8D Vwrc7D59ZwOG3ianRT7wF6cptOrXrpoVd74iQm5DJ6prrvQKzXtbjMAjEpiPeeUtMeYn kcF0s4Fa+TRsmjMFUw049o9THXkDAisBqya7GdDgF8Ev+zMg60a4LkQPg4kow676F9/K 5UnH1t3Gj6N8qLcy1Xhx87uPBCdzif5UVqwYFqMYoowRPuKI2J3HsNuusRL6KJcVhHKz Q20b1DBQI40tsS1eQCXxRpTK1TG6BuPlaAr2Gy07GkGhhRBaDxPKl2MxaPHQcbyiq1dn 60qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dryKzknTwjOf+VunOu1ss5DcnVHNtdSKVmRMmz8L7/M=; b=MM8EljvAOF/rrbcLc/XU+qH47vekRV/EoxxZ/YQfTR+qXESCZXStwtMmNUMj1JEYj5 M2N86M18jlFoN++kFf0DT98PMOTBPiWqkMsYYUZhB/DIqKiJ7P6loU+mW/b3Znpj+PN3 KoXCXWHQjvmYG+bHgIgLKP7s1GzWDP5L9I/1XDFm5jmx4rXn2avmCQpTp7xs3qpejpV/ zWGTc//WCofc/Ywiz8zMRV0rUuEimObRxdSbZv+SWM5zXAdNcNF68xUfTt3kTLKaDolz TjASgxW0odmVDcbEO+nMdw2xfdpP6K2aiN0YmTG6vrLGA/2qVnkjJ2TFLbbfeA+tejeF IiFg== X-Gm-Message-State: AJIora9viCV+d6z+RARWYc0BGWKS39V9D1VaSD6udfZSqU/ypQuvxsIN wLEOBmA3idc0U68SkJycWtF9cnGK5S4= X-Received: by 2002:a63:d456:0:b0:41a:aa82:cd9e with SMTP id i22-20020a63d456000000b0041aaa82cd9emr2321179pgj.271.1659087823198; Fri, 29 Jul 2022 02:43:43 -0700 (PDT) Received: from localhost ([47.89.225.180]) by smtp.gmail.com with ESMTPSA id h2-20020a656382000000b003fadfd7be5asm2256495pgv.18.2022.07.29.02.43.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Jul 2022 02:43:42 -0700 (PDT) From: Lai Jiangshan To: linux-kernel@vger.kernel.org Cc: Lai Jiangshan , Tejun Heo , Lai Jiangshan , Zqiang Subject: [PATCH] workqueue: Avoid a false warning in unbind_workers() Date: Fri, 29 Jul 2022 17:44:38 +0800 Message-Id: <20220729094438.3941-1-jiangshanlai@gmail.com> X-Mailer: git-send-email 2.19.1.6.gb485710b MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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: X-Mailing-List: linux-kernel@vger.kernel.org From: Lai Jiangshan Doing set_cpus_allowed_ptr() with wq_unbound_cpumask can be possible fails and trigger the false warning. Use cpu_possible_mask instead when wq_unbound_cpumask has no active CPUs. It is very easy to trigger the warning: Set wq_unbound_cpumask to a small set of CPUs. Offline all the CPUs of wq_unbound_cpumask. Offline an extra CPU and trigger the warning. Fixes: 10a5a651e3af("workqueue: Restrict kworker in the offline CPU pool running on housekeeping CPUs") Signed-off-by: Lai Jiangshan --- kernel/workqueue.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 355897b790a5..a429b50b06e6 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -4975,7 +4975,10 @@ 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, wq_unbound_cpumask) < 0); + if (cpumask_intersects(wq_unbound_cpumask, cpu_active_mask)) + WARN_ON_ONCE(set_cpus_allowed_ptr(worker->task, wq_unbound_cpumask) < 0); + else + WARN_ON_ONCE(set_cpus_allowed_ptr(worker->task, cpu_possible_mask) < 0); } mutex_unlock(&wq_pool_attach_mutex); -- 2.19.1.6.gb485710b