Commit 672ab41e authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Fix CPU hotplug in networking

The code directly accessed the "cpucontrol" semaphore used
for CPU hotplug. That doesn't work all that well, since the
semaphore doesn't even exist on UP.
parent 37b5d10a
...@@ -37,7 +37,12 @@ extern int register_cpu_notifier(struct notifier_block *nb); ...@@ -37,7 +37,12 @@ extern int register_cpu_notifier(struct notifier_block *nb);
extern void unregister_cpu_notifier(struct notifier_block *nb); extern void unregister_cpu_notifier(struct notifier_block *nb);
int cpu_up(unsigned int cpu); int cpu_up(unsigned int cpu);
#define lock_cpu_hotplug() down(&cpucontrol)
#define unlock_cpu_hotplug() up(&cpucontrol)
#else #else
static inline int register_cpu_notifier(struct notifier_block *nb) static inline int register_cpu_notifier(struct notifier_block *nb)
{ {
return 0; return 0;
...@@ -45,6 +50,10 @@ static inline int register_cpu_notifier(struct notifier_block *nb) ...@@ -45,6 +50,10 @@ static inline int register_cpu_notifier(struct notifier_block *nb)
static inline void unregister_cpu_notifier(struct notifier_block *nb) static inline void unregister_cpu_notifier(struct notifier_block *nb)
{ {
} }
#define lock_cpu_hotplug() do { } while (0)
#define unlock_cpu_hotplug() do { } while (0)
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
extern struct sysdev_class cpu_sysdev_class; extern struct sysdev_class cpu_sysdev_class;
......
...@@ -286,7 +286,7 @@ void flow_cache_flush(void) ...@@ -286,7 +286,7 @@ void flow_cache_flush(void)
/* Don't want cpus going down or up during this, also protects /* Don't want cpus going down or up during this, also protects
* against multiple callers. */ * against multiple callers. */
down(&cpucontrol); lock_cpu_hotplug();
atomic_set(&info.cpuleft, num_online_cpus()); atomic_set(&info.cpuleft, num_online_cpus());
init_completion(&info.completion); init_completion(&info.completion);
...@@ -296,7 +296,7 @@ void flow_cache_flush(void) ...@@ -296,7 +296,7 @@ void flow_cache_flush(void)
local_bh_enable(); local_bh_enable();
wait_for_completion(&info.completion); wait_for_completion(&info.completion);
up(&cpucontrol); unlock_cpu_hotplug();
} }
static void __devinit flow_cache_cpu_prepare(int cpu) static void __devinit flow_cache_cpu_prepare(int cpu)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment