All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] get/put_cpu in up need not disable preemption
@ 2002-11-09 10:06 Ravikiran G Thirumalai
  2002-11-09 18:53 ` Robert Love
  0 siblings, 1 reply; 2+ messages in thread
From: Ravikiran G Thirumalai @ 2002-11-09 10:06 UTC (permalink / raw)
  To: Robert Love; +Cc: linux-kernel

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 */

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-11-09 18:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-09 10:06 [patch] get/put_cpu in up need not disable preemption Ravikiran G Thirumalai
2002-11-09 18:53 ` Robert Love

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.