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