+#ifdef CONFIG_SMP
+/*
+ * Define our own context switch locking. This allows us to enable
+ * interrupts over the context switch, otherwise we end up with high
+ * interrupt latency. The real problem area is switch_mm() which may
+ * do a full cache flush.
+ */
+#define prepare_arch_switch(rq,next) \
+do { \
+ spin_lock(&(next)->switch_lock); \
+ spin_unlock_irq(&(rq)->lock); \
+} while (0)
+
+#define finish_arch_switch(rq,prev) \
+ spin_unlock(&(prev)->switch_lock)
+
+#define task_running(rq,p) \
+ ((rq)->curr == (p) || spin_is_locked(&(p)->switch_lock))
+#else
+/*
+ * Our UP-case is more simple, but we assume knowledge of how
+ * spin_unlock_irq() and friends are implemented. This avoids
+ * us needlessly decrementing and incrementing the preempt count.
+ */
+#define prepare_arch_switch(rq,next) local_irq_enable()
+#define finish_arch_switch(rq,prev) spin_unlock(&(rq)->lock)
+#define task_running(rq,p) ((rq)->curr == (p))
+#endif