]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Fix CPU hotplug in networking
authorAndrew Morton <akpm@osdl.org>
Fri, 23 Jan 2004 03:00:26 +0000 (19:00 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Fri, 23 Jan 2004 03:00:26 +0000 (19:00 -0800)
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.

include/linux/cpu.h
net/core/flow.c

index 2f374d79f15771b002bb0a9d48a77840f1d2f4b3..02579ec6b99cfc4e92d17394e6fcd57553e95466 100644 (file)
@@ -37,7 +37,12 @@ extern int register_cpu_notifier(struct notifier_block *nb);
 extern void unregister_cpu_notifier(struct notifier_block *nb);
 
 int cpu_up(unsigned int cpu);
+
+#define lock_cpu_hotplug()     down(&cpucontrol)
+#define unlock_cpu_hotplug()   up(&cpucontrol)
+
 #else
+
 static inline int register_cpu_notifier(struct notifier_block *nb)
 {
        return 0;
@@ -45,6 +50,10 @@ static inline int register_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 */
 extern struct sysdev_class cpu_sysdev_class;
 
index 4c920bb527078a13273f32eb38f060f331c574a1..f13a1752b6032c27a423876e10300f3a3f143ef7 100644 (file)
@@ -286,7 +286,7 @@ void flow_cache_flush(void)
 
        /* Don't want cpus going down or up during this, also protects
         * against multiple callers. */
-       down(&cpucontrol);
+       lock_cpu_hotplug();
        atomic_set(&info.cpuleft, num_online_cpus());
        init_completion(&info.completion);
 
@@ -296,7 +296,7 @@ void flow_cache_flush(void)
        local_bh_enable();
 
        wait_for_completion(&info.completion);
-       up(&cpucontrol);
+       unlock_cpu_hotplug();
 }
 
 static void __devinit flow_cache_cpu_prepare(int cpu)