From patchwork Tue Jun 7 15:14:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gautham R Shenoy X-Patchwork-Id: 631667 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rPFXs3VrSz9sBR for ; Wed, 8 Jun 2016 01:17:01 +1000 (AEST) Received: from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3rPFXs2QLMzDqsh for ; Wed, 8 Jun 2016 01:17:01 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from e31.co.us.ibm.com (e31.co.us.ibm.com [32.97.110.149]) (using TLSv1.2 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3rPFVH5pl3zDqHQ for ; Wed, 8 Jun 2016 01:14:47 +1000 (AEST) Received: from localhost by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 7 Jun 2016 09:14:42 -0600 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e31.co.us.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 7 Jun 2016 09:14:39 -0600 X-IBM-Helo: d03dlp02.boulder.ibm.com X-IBM-MailFrom: ego@linux.vnet.ibm.com X-IBM-RcptTo: mpe@ellerman.id.au; htejun@gmail.com; peterz@infradead.org; tglx@linutronix.de; linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org Received: from b01cxnp23034.gho.pok.ibm.com (b01cxnp23034.gho.pok.ibm.com [9.57.198.29]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 90DA93E40060; Tue, 7 Jun 2016 09:14:38 -0600 (MDT) Received: from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com [9.57.199.107]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u57FEcpX41811992; Tue, 7 Jun 2016 15:14:38 GMT Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 14673124044; Tue, 7 Jun 2016 11:14:38 -0400 (EDT) Received: from sofia.in.ibm.com (unknown [9.124.35.134]) by b01ledav002.gho.pok.ibm.com (Postfix) with ESMTP id C26AB12403D; Tue, 7 Jun 2016 11:14:37 -0400 (EDT) Received: from sofia.in.ibm.com (localhost.localdomain [127.0.0.1]) by sofia.in.ibm.com (Postfix) with ESMTP id 43576A218B; Tue, 7 Jun 2016 20:44:34 +0530 (IST) Received: (from ego@localhost) by sofia.in.ibm.com (8.14.8/8.14.8/Submit) id u57FEW93017989; Tue, 7 Jun 2016 20:44:32 +0530 From: "Gautham R. Shenoy" To: Peter Zijlstra , Thomas Gleixner , Tejun Heo , Michael Ellerman , Abdul Haleem , Aneesh Kumar Subject: [PATCH 1/2] workqueue: Move wq_update_unbound_numa() to the beginning of CPU_ONLINE Date: Tue, 7 Jun 2016 20:44:02 +0530 Message-Id: <6b3c7059ec5d2d6157d23d619e4507692a42a5bd.1465311052.git.ego@linux.vnet.ibm.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: References: <5756BE20.3040208@linux.vnet.ibm.com> In-Reply-To: References: X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16060715-8236-0000-0000-000031FE91F4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Gautham R. Shenoy" , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Currently in the CPU_ONLINE workqueue handler, the restore_unbound_workers_cpumask() will never call set_cpus_allowed_ptr() for a newly created unbound worker thread. This is because the function which creates a new unbound worker thread when the first CPU in the node comes online [wq_update_unbound_numa()] is invoked after the call to restore_unbound_workers_cpumask(). Thus the affinity is never set for this worker thread when the first CPU in the node comes online. Furthermore, due to an optimization in restore_unbound_workers_cpumask(), set_cpus_allowed_ptr() is not called when subsequent CPUs in the node come online since it assumes that the affinity would have been set when the first CPU has come online. This patch fixes this issue by invoking wq_update_unbound_numa() before the calling restore_unbound_workers_cpumask(). Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Tejun Heo Cc: Michael Ellerman Signed-off-by: Gautham R. Shenoy --- kernel/workqueue.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index e1c0e99..e412794 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -4638,6 +4638,10 @@ static int workqueue_cpu_up_callback(struct notifier_block *nfb, case CPU_ONLINE: mutex_lock(&wq_pool_mutex); + /* update NUMA affinity of unbound workqueues */ + list_for_each_entry(wq, &workqueues, list) + wq_update_unbound_numa(wq, cpu, true); + for_each_pool(pool, pi) { mutex_lock(&pool->attach_mutex); @@ -4649,10 +4653,6 @@ static int workqueue_cpu_up_callback(struct notifier_block *nfb, mutex_unlock(&pool->attach_mutex); } - /* update NUMA affinity of unbound workqueues */ - list_for_each_entry(wq, &workqueues, list) - wq_update_unbound_numa(wq, cpu, true); - mutex_unlock(&wq_pool_mutex); break; }