From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932130Ab3AVHrJ (ORCPT ); Tue, 22 Jan 2013 02:47:09 -0500 Received: from e23smtp01.au.ibm.com ([202.81.31.143]:37348 "EHLO e23smtp01.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754971Ab3AVHrE (ORCPT ); Tue, 22 Jan 2013 02:47:04 -0500 From: "Srivatsa S. Bhat" Subject: [PATCH v5 43/45] 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 Date: Tue, 22 Jan 2013 13:14:58 +0530 Message-ID: <20130122074454.13822.21675.stgit@srivatsabhat.in.ibm.com> In-Reply-To: <20130122073210.13822.50434.stgit@srivatsabhat.in.ibm.com> References: <20130122073210.13822.50434.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: 13012207-1618-0000-0000-0000033A4023 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 1c84138..7a51fb6 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 e23smtp08.au.ibm.com (e23smtp08.au.ibm.com [202.81.31.141]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "e23smtp08.au.ibm.com", Issuer "GeoTrust SSL CA" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 45EA82C067D for ; Tue, 22 Jan 2013 18:47:02 +1100 (EST) Received: from /spool/local by e23smtp08.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 22 Jan 2013 17:45:29 +1000 Received: from d23relay03.au.ibm.com (d23relay03.au.ibm.com [9.190.235.21]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id E90ED2CE804D for ; Tue, 22 Jan 2013 18:46:58 +1100 (EST) Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r0M7kw4H65339412 for ; Tue, 22 Jan 2013 18:46:58 +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 r0M7kv7B009088 for ; Tue, 22 Jan 2013 18:46:58 +1100 From: "Srivatsa S. Bhat" Subject: [PATCH v5 43/45] 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: Tue, 22 Jan 2013 13:14:58 +0530 Message-ID: <20130122074454.13822.21675.stgit@srivatsabhat.in.ibm.com> In-Reply-To: <20130122073210.13822.50434.stgit@srivatsabhat.in.ibm.com> References: <20130122073210.13822.50434.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, 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 1c84138..7a51fb6 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: Tue, 22 Jan 2013 13:14:58 +0530 Subject: [PATCH v5 43/45] cpu: No more __stop_machine() in _cpu_down() In-Reply-To: <20130122073210.13822.50434.stgit@srivatsabhat.in.ibm.com> References: <20130122073210.13822.50434.stgit@srivatsabhat.in.ibm.com> Message-ID: <20130122074454.13822.21675.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 1c84138..7a51fb6 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. */