Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753829AbdFMUKe (ORCPT ); Tue, 13 Jun 2017 16:10:34 -0400 Received: from mail-yw0-f182.google.com ([209.85.161.182]:33840 "EHLO mail-yw0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752643AbdFMUKd (ORCPT ); Tue, 13 Jun 2017 16:10:33 -0400 Date: Tue, 13 Jun 2017 16:10:29 -0400 From: Tejun Heo To: Michael Bringmann Cc: Lai Jiangshan , linux-kernel@vger.kernel.org, Nathan Fontenot Subject: Re: [PATCH] workqueue: Ensure that cpumask set for pools created after boot Message-ID: <20170613201029.GA7359@htj.duckdns.org> References: <20170525150353.GE23493@htj.duckdns.org> <20170525150752.GF23493@htj.duckdns.org> <20170606180913.GA32062@htj.duckdns.org> <736f7f6e-8d47-eaea-acc6-8ed75014a287@linux.vnet.ibm.com> <20170612161433.GB19206@htj.duckdns.org> <69c4bbad-5d40-d054-0004-38ac81377b0b@linux.vnet.ibm.com> <20170612173225.GD19206@htj.duckdns.org> <0b95fc96-a481-4439-de65-ffdffa207f47@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0b95fc96-a481-4439-de65-ffdffa207f47@linux.vnet.ibm.com> User-Agent: Mutt/1.8.2 (2017-04-18) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1297 Lines: 41 Hello, On Tue, Jun 13, 2017 at 03:04:30PM -0500, Michael Bringmann wrote: > @@ -3564,19 +3564,28 @@ static struct pool_workqueue *alloc_unbound_pwq(struct workqueue_struct *wq, > static bool wq_calc_node_cpumask(const struct workqueue_attrs *attrs, int node, > int cpu_going_down, cpumask_t *cpumask) > { > + cpumask_t onl_targ_cm; > + > if (!wq_numa_enabled || attrs->no_numa) > goto use_dfl; > > /* does @node have any online CPUs @attrs wants? */ > - cpumask_and(cpumask, cpumask_of_node(node), attrs->cpumask); > + cpumask_and(&onl_targ_cm, cpumask_of_node(node), attrs->cpumask); > if (cpu_going_down >= 0) > - cpumask_clear_cpu(cpu_going_down, cpumask); > + cpumask_clear_cpu(cpu_going_down, &onl_targ_cm); > > - if (cpumask_empty(cpumask)) > + if (cpumask_empty(&onl_targ_cm)) > goto use_dfl; > > /* yeap, return possible CPUs in @node that @attrs wants */ > cpumask_and(cpumask, attrs->cpumask, wq_numa_possible_cpumask[node]); > + > + if (cpumask_weight(&onl_targ_cm) > cpumask_weight(cpumask)) { > + printk(KERN_INFO "WARNING: WQ cpumask: onl intersect > " > + "possible intersect\n"); > + return false; > + } Yeah, alternatively, we can just add right before returning, if (WARN_ON(cpumask_empty(cpumask))) return false; Thanks. -- tejun