Commit 9c73428c authored by Robert Love's avatar Robert Love Committed by Linus Torvalds

[PATCH] Optimized UP preempt fix

I previously sent a patch by Mikael Pettersson to fix the UP+preempt
problem.  It seems from your BK repository you have not yet merged it;
if so, this patch takes a different approach which is optimal, removing
the unneeded conditional altogether in the UP case.  I have verified UP
and SMP are now correct.  Patch is against 2.5.4, please apply.

	Robert Love
parent d278bd1e
......@@ -12,10 +12,15 @@ extern spinlock_t kernel_flag;
#ifdef CONFIG_SMP
#define kernel_locked() spin_is_locked(&kernel_flag)
#define check_irq_holder(cpu) \
do { \
if (global_irq_holder == (cpu)) \
BUG(); \
} while(0)
#else
#ifdef CONFIG_PREEMPT
#define kernel_locked() preempt_get_count()
#define global_irq_holder 0
#define check_irq_holder(cpu) do { } while(0)
#else
#define kernel_locked() 1
#endif
......@@ -28,8 +33,7 @@ extern spinlock_t kernel_flag;
do { \
if (unlikely(task->lock_depth >= 0)) { \
spin_unlock(&kernel_flag); \
if (global_irq_holder == (cpu)) \
BUG(); \
check_irq_holder(cpu); \
} \
} while (0)
......
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