[patch] get/put_cpu in up need not disable preemption

From: Ravikiran G Thirumalai (kiran@in.ibm.com)
Date: Sat Nov 09 2002 - 05:06:34 EST


AFAICS, get_cpu, put_cpu and put_cpu_no_resched need not disable
preemption on a uniprocessor. Foll patch removes the disable/enable
premeption stuff for the UP case. Tested on a PIII 4 way for both
UP and SMP configs. Pls apply.

Thanks,
Kiran

diff -ruN -X dontdiff linux-2.5.46/include/linux/smp.h get_cpu-2.5.46/include/linux/smp.h
--- linux-2.5.46/include/linux/smp.h Tue Nov 5 04:00:31 2002
+++ get_cpu-2.5.46/include/linux/smp.h Sat Nov 9 12:27:46 2002
@@ -78,6 +78,11 @@
 extern void unregister_cpu_notifier(struct notifier_block *nb);
 
 int cpu_up(unsigned int cpu);
+
+#define get_cpu() ({ preempt_disable(); smp_processor_id(); })
+#define put_cpu() preempt_enable()
+#define put_cpu_no_resched() preempt_enable_no_resched()
+
 #else /* !SMP */
 
 /*
@@ -106,10 +111,11 @@
 static inline void unregister_cpu_notifier(struct notifier_block *nb)
 {
 }
-#endif /* !SMP */
 
-#define get_cpu() ({ preempt_disable(); smp_processor_id(); })
-#define put_cpu() preempt_enable()
-#define put_cpu_no_resched() preempt_enable_no_resched()
+#define get_cpu() smp_processor_id()
+#define put_cpu() do { } while (0)
+#define put_cpu_no_resched() do { } while (0)
+
+#endif /* !SMP */
 
 #endif /* __LINUX_SMP_H */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Nov 15 2002 - 22:00:17 EST