diff --git a/kernel/cpu.c b/kernel/cpu.c index c75fcdd..d419eb3 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -135,6 +135,7 @@ int __ref register_cpu_notifier(struct notifier_block *nb) #ifdef CONFIG_HOTPLUG_CPU +static void (*pm_idle_saved) (void) __read_mostly; EXPORT_SYMBOL(register_cpu_notifier); void __ref unregister_cpu_notifier(struct notifier_block *nb) @@ -145,6 +146,19 @@ void __ref unregister_cpu_notifier(struct notifier_block *nb) } EXPORT_SYMBOL(unregister_cpu_notifier); +static inline void save_pm_idle(void) +{ + pm_idle_saved = pm_idle; + pm_idle = default_idle; + cpu_idle_wait(); +} + +static inline void restore_pm_idle(void) +{ + pm_idle = pm_idle_saved; + cpu_idle_wait(); +} + static inline void check_for_tasks(int cpu) { struct task_struct *p; @@ -278,7 +292,9 @@ int __ref cpu_down(unsigned int cpu) goto out; } + save_pm_idle(); err = _cpu_down(cpu, 0); + restore_pm_idle(); out: cpu_maps_update_done(); @@ -376,7 +392,9 @@ int __cpuinit cpu_up(unsigned int cpu) goto out; } + save_pm_idle(); err = _cpu_up(cpu, 0); + restore_pm_idle(); out: cpu_maps_update_done();