From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932165AbdJUQ3e (ORCPT ); Sat, 21 Oct 2017 12:29:34 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:45497 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932090AbdJUQ3d (ORCPT ); Sat, 21 Oct 2017 12:29:33 -0400 X-Google-Smtp-Source: ABhQp+SxGDVEQjmuAbvV9ENH76AX9qQXmO6JUHVUj9bhQ1vA05pRicwTOJzGTxPNq3yhtzVMYGo+1g== From: Tal Shorer To: tj@kernel.org, jiangshanlai@gmail.com, linux-kernel@vger.kernel.org Cc: Tal Shorer Subject: [PATCH v2] workqueue: respect isolated cpus when queueing an unbound work Date: Sat, 21 Oct 2017 19:29:24 +0300 Message-Id: <1508603364-892-1-git-send-email-tal.shorer@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <20171021161533.GQ1302522@devbig577.frc2.facebook.com> References: <20171021161533.GQ1302522@devbig577.frc2.facebook.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Initialize wq_unbound_cpumask to exclude cpus that were isolated by the cmdline's isolcpus parameter. Signed-off-by: Tal Shorer --- kernel/workqueue.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index ca937b0..0add5d4 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -4947,6 +4947,10 @@ int workqueue_set_unbound_cpumask(cpumask_var_t cpumask) if (!zalloc_cpumask_var(&saved_cpumask, GFP_KERNEL)) return -ENOMEM; + /* + * Not excluding isolated cpus on purpose. + * If the user wishes to include them, we allow that. + */ cpumask_and(cpumask, cpumask, cpu_possible_mask); if (!cpumask_empty(cpumask)) { apply_wqattrs_lock(); @@ -5546,7 +5550,7 @@ int __init workqueue_init_early(void) WARN_ON(__alignof__(struct pool_workqueue) < __alignof__(long long)); BUG_ON(!alloc_cpumask_var(&wq_unbound_cpumask, GFP_KERNEL)); - cpumask_copy(wq_unbound_cpumask, cpu_possible_mask); + cpumask_andnot(wq_unbound_cpumask, cpu_possible_mask, cpu_isolated_map); pwq_cache = KMEM_CACHE(pool_workqueue, SLAB_PANIC); -- 2.7.4