aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cpu.c
diff options
context:
space:
mode:
authorSuresh Siddha <suresh.b.siddha@intel.com>2010-11-23 19:11:40 -0500
committerH. Peter Anvin <hpa@linux.intel.com>2010-12-13 19:23:56 -0500
commit3fb82d56ad003e804923185316236f26b30dfdd5 (patch)
tree3ee08bef7cdc0f0ed3b69be5609b53c44299a229 /kernel/cpu.c
parentcf7d7e5a1980d1116ee152d25dac382b112b9c17 (diff)
x86, suspend: Avoid unnecessary smp alternatives switch during suspend/resume
During suspend, we disable all the non boot cpus. And during resume we bring them all back again. So no need to do alternatives_smp_switch() in between. On my core 2 based laptop, this speeds up the suspend path by 15msec and the resume path by 5 msec (suspend/resume speed up differences can be attributed to the different P-states that the cpu is in during suspend/resume). Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> LKML-Reference: <1290557500.4946.8.camel@sbsiddha-MOBL3.sc.intel.com> Cc: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'kernel/cpu.c')
-rw-r--r--kernel/cpu.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c
index f6e726f18491..8ccc182069ec 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -386,6 +386,14 @@ out:
386#ifdef CONFIG_PM_SLEEP_SMP 386#ifdef CONFIG_PM_SLEEP_SMP
387static cpumask_var_t frozen_cpus; 387static cpumask_var_t frozen_cpus;
388 388
389void __weak arch_disable_nonboot_cpus_begin(void)
390{
391}
392
393void __weak arch_disable_nonboot_cpus_end(void)
394{
395}
396
389int disable_nonboot_cpus(void) 397int disable_nonboot_cpus(void)
390{ 398{
391 int cpu, first_cpu, error = 0; 399 int cpu, first_cpu, error = 0;
@@ -397,6 +405,7 @@ int disable_nonboot_cpus(void)
397 * with the userspace trying to use the CPU hotplug at the same time 405 * with the userspace trying to use the CPU hotplug at the same time
398 */ 406 */
399 cpumask_clear(frozen_cpus); 407 cpumask_clear(frozen_cpus);
408 arch_disable_nonboot_cpus_begin();
400 409
401 printk("Disabling non-boot CPUs ...\n"); 410 printk("Disabling non-boot CPUs ...\n");
402 for_each_online_cpu(cpu) { 411 for_each_online_cpu(cpu) {
@@ -412,6 +421,8 @@ int disable_nonboot_cpus(void)
412 } 421 }
413 } 422 }
414 423
424 arch_disable_nonboot_cpus_end();
425
415 if (!error) { 426 if (!error) {
416 BUG_ON(num_online_cpus() > 1); 427 BUG_ON(num_online_cpus() > 1);
417 /* Make sure the CPUs won't be enabled by someone else */ 428 /* Make sure the CPUs won't be enabled by someone else */