From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: tglx@linutronix.de, sbw@mit.edu,
srivatsa.bhat@linux.vnet.ibm.com, rusty@rustcorp.com.au,
vincent.guittot@linaro.org, amit.kucheria@linaro.org
Subject: [PATCH RFC] cpu: No more __stop_machine() in _cpu_down()
Date: Thu, 26 Jul 2012 14:19:27 -0700 [thread overview]
Message-ID: <20120726211927.GA26016@linux.vnet.ibm.com> (raw)
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_cpus() for __stop_machine() in order to improve
both performance and real-time latency.
This is currently unsafe, because there are a number of uses of
preempt_disable() that are intended to block CPU-hotplug offlining.
These will be fixed, but in the meantime, this commit is one way to help
locate them. It nevertheless passes light rcutorture/hotplug stress
testing. Meaning that we should not be relying on pure testing to find
places where people are relying on preemption disabling to block CPUs
from going offline. ;-)
Not-yet-signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
diff --git a/kernel/cpu.c b/kernel/cpu.c
index a4eb522..47e63a0 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -243,13 +243,18 @@ static int __ref take_cpu_down(void *_param)
{
struct take_cpu_down_param *param = _param;
int err;
+ unsigned long flags;
/* Ensure this CPU doesn't handle any more interrupts. */
+ local_irq_save(flags);
err = __cpu_disable();
- if (err < 0)
+ if (err < 0) {
+ local_irq_restore(flags);
return err;
+ }
cpu_notify(CPU_DYING | param->mod, param->hcpu);
+ local_irq_restore(flags);
return 0;
}
@@ -281,7 +286,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
goto out_release;
}
- err = __stop_machine(take_cpu_down, &tcd_param, cpumask_of(cpu));
+ err = stop_cpus(cpumask_of(cpu), take_cpu_down, &tcd_param);
if (err) {
/* CPU didn't die: tell everyone. Can't complain. */
cpu_notify_nofail(CPU_DOWN_FAILED | mod, hcpu);
reply other threads:[~2012-07-26 21:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120726211927.GA26016@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=amit.kucheria@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=sbw@mit.edu \
--cc=srivatsa.bhat@linux.vnet.ibm.com \
--cc=tglx@linutronix.de \
--cc=vincent.guittot@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.