From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757271Ab3BRMqq (ORCPT ); Mon, 18 Feb 2013 07:46:46 -0500 Received: from e23smtp04.au.ibm.com ([202.81.31.146]:41083 "EHLO e23smtp04.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757165Ab3BRMql (ORCPT ); Mon, 18 Feb 2013 07:46:41 -0500 From: "Srivatsa S. Bhat" Subject: [PATCH v6 44/46] cpu: No more __stop_machine() in _cpu_down() To: tglx@linutronix.de, peterz@infradead.org, tj@kernel.org, oleg@redhat.com, paulmck@linux.vnet.ibm.com, rusty@rustcorp.com.au, mingo@kernel.org, akpm@linux-foundation.org, namhyung@kernel.org Cc: rostedt@goodmis.org, wangyun@linux.vnet.ibm.com, xiaoguangrong@linux.vnet.ibm.com, rjw@sisk.pl, sbw@mit.edu, fweisbec@gmail.com, linux@arm.linux.org.uk, nikunj@linux.vnet.ibm.com, srivatsa.bhat@linux.vnet.ibm.com, linux-pm@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, walken@google.com, vincent.guittot@linaro.org Date: Mon, 18 Feb 2013 18:14:31 +0530 Message-ID: <20130218124431.26245.10956.stgit@srivatsabhat.in.ibm.com> In-Reply-To: <20130218123714.26245.61816.stgit@srivatsabhat.in.ibm.com> References: <20130218123714.26245.61816.stgit@srivatsabhat.in.ibm.com> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13021812-9264-0000-0000-0000032CB96A Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Paul E. McKenney The _cpu_down() function invoked as part of the CPU-hotplug offlining process currently invokes __stop_machine(), which is slow and inflicts substantial real-time latencies on the entire system. This patch substitutes stop_one_cpu() for __stop_machine() in order to improve both performance and real-time latency. There were a number of uses of preempt_disable() or local_irq_disable() that were intended to block CPU-hotplug offlining. These were fixed by using get/put_online_cpus_atomic(), which is the new synchronization primitive to prevent CPU offline, while invoking from atomic context. Signed-off-by: Paul E. McKenney Signed-off-by: Paul E. McKenney [ srivatsa.bhat@linux.vnet.ibm.com: Refer to the new sync primitives for readers (in the changelog); s/stop_cpus/stop_one_cpu and fix comment referring to stop_machine in the code] Signed-off-by: Srivatsa S. Bhat --- kernel/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/cpu.c b/kernel/cpu.c index 58dd1df..652fb53 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -337,7 +337,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen) } smpboot_park_threads(cpu); - err = __stop_machine(take_cpu_down, &tcd_param, cpumask_of(cpu)); + err = stop_one_cpu(cpu, take_cpu_down, &tcd_param); if (err) { /* CPU didn't die: tell everyone. Can't complain. */ smpboot_unpark_threads(cpu); @@ -349,7 +349,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen) /* * The migration_call() CPU_DYING callback will have removed all * runnable tasks from the cpu, there's only the idle task left now - * that the migration thread is done doing the stop_machine thing. + * that the migration thread is done doing the stop_one_cpu() thing. * * Wait for the stop thread to go away. */ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from e23smtp06.au.ibm.com (e23smtp06.au.ibm.com [202.81.31.148]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "e23smtp06.au.ibm.com", Issuer "GeoTrust SSL CA" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 8A4E82C0955 for ; Mon, 18 Feb 2013 23:46:39 +1100 (EST) Received: from /spool/local by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 18 Feb 2013 22:42:06 +1000 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [9.190.234.120]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id 6D05B357804E for ; Mon, 18 Feb 2013 23:46:36 +1100 (EST) Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r1ICYIxj6488500 for ; Mon, 18 Feb 2013 23:34:18 +1100 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r1ICkYiO006934 for ; Mon, 18 Feb 2013 23:46:36 +1100 From: "Srivatsa S. Bhat" Subject: [PATCH v6 44/46] cpu: No more __stop_machine() in _cpu_down() To: tglx@linutronix.de, peterz@infradead.org, tj@kernel.org, oleg@redhat.com, paulmck@linux.vnet.ibm.com, rusty@rustcorp.com.au, mingo@kernel.org, akpm@linux-foundation.org, namhyung@kernel.org Date: Mon, 18 Feb 2013 18:14:31 +0530 Message-ID: <20130218124431.26245.10956.stgit@srivatsabhat.in.ibm.com> In-Reply-To: <20130218123714.26245.61816.stgit@srivatsabhat.in.ibm.com> References: <20130218123714.26245.61816.stgit@srivatsabhat.in.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Cc: linux-arch@vger.kernel.org, linux@arm.linux.org.uk, nikunj@linux.vnet.ibm.com, linux-pm@vger.kernel.org, fweisbec@gmail.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, rostedt@goodmis.org, xiaoguangrong@linux.vnet.ibm.com, rjw@sisk.pl, sbw@mit.edu, wangyun@linux.vnet.ibm.com, srivatsa.bhat@linux.vnet.ibm.com, netdev@vger.kernel.org, vincent.guittot@linaro.org, walken@google.com, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Paul E. McKenney The _cpu_down() function invoked as part of the CPU-hotplug offlining process currently invokes __stop_machine(), which is slow and inflicts substantial real-time latencies on the entire system. This patch substitutes stop_one_cpu() for __stop_machine() in order to improve both performance and real-time latency. There were a number of uses of preempt_disable() or local_irq_disable() that were intended to block CPU-hotplug offlining. These were fixed by using get/put_online_cpus_atomic(), which is the new synchronization primitive to prevent CPU offline, while invoking from atomic context. Signed-off-by: Paul E. McKenney Signed-off-by: Paul E. McKenney [ srivatsa.bhat@linux.vnet.ibm.com: Refer to the new sync primitives for readers (in the changelog); s/stop_cpus/stop_one_cpu and fix comment referring to stop_machine in the code] Signed-off-by: Srivatsa S. Bhat --- kernel/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/cpu.c b/kernel/cpu.c index 58dd1df..652fb53 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -337,7 +337,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen) } smpboot_park_threads(cpu); - err = __stop_machine(take_cpu_down, &tcd_param, cpumask_of(cpu)); + err = stop_one_cpu(cpu, take_cpu_down, &tcd_param); if (err) { /* CPU didn't die: tell everyone. Can't complain. */ smpboot_unpark_threads(cpu); @@ -349,7 +349,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen) /* * The migration_call() CPU_DYING callback will have removed all * runnable tasks from the cpu, there's only the idle task left now - * that the migration thread is done doing the stop_machine thing. + * that the migration thread is done doing the stop_one_cpu() thing. * * Wait for the stop thread to go away. */ From mboxrd@z Thu Jan 1 00:00:00 1970 From: srivatsa.bhat@linux.vnet.ibm.com (Srivatsa S. Bhat) Date: Mon, 18 Feb 2013 18:14:31 +0530 Subject: [PATCH v6 44/46] cpu: No more __stop_machine() in _cpu_down() In-Reply-To: <20130218123714.26245.61816.stgit@srivatsabhat.in.ibm.com> References: <20130218123714.26245.61816.stgit@srivatsabhat.in.ibm.com> Message-ID: <20130218124431.26245.10956.stgit@srivatsabhat.in.ibm.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org From: Paul E. McKenney The _cpu_down() function invoked as part of the CPU-hotplug offlining process currently invokes __stop_machine(), which is slow and inflicts substantial real-time latencies on the entire system. This patch substitutes stop_one_cpu() for __stop_machine() in order to improve both performance and real-time latency. There were a number of uses of preempt_disable() or local_irq_disable() that were intended to block CPU-hotplug offlining. These were fixed by using get/put_online_cpus_atomic(), which is the new synchronization primitive to prevent CPU offline, while invoking from atomic context. Signed-off-by: Paul E. McKenney Signed-off-by: Paul E. McKenney [ srivatsa.bhat at linux.vnet.ibm.com: Refer to the new sync primitives for readers (in the changelog); s/stop_cpus/stop_one_cpu and fix comment referring to stop_machine in the code] Signed-off-by: Srivatsa S. Bhat --- kernel/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/cpu.c b/kernel/cpu.c index 58dd1df..652fb53 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -337,7 +337,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen) } smpboot_park_threads(cpu); - err = __stop_machine(take_cpu_down, &tcd_param, cpumask_of(cpu)); + err = stop_one_cpu(cpu, take_cpu_down, &tcd_param); if (err) { /* CPU didn't die: tell everyone. Can't complain. */ smpboot_unpark_threads(cpu); @@ -349,7 +349,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen) /* * The migration_call() CPU_DYING callback will have removed all * runnable tasks from the cpu, there's only the idle task left now - * that the migration thread is done doing the stop_machine thing. + * that the migration thread is done doing the stop_one_cpu() thing. * * Wait for the stop thread to go away. */