* Daniel Walker <[EMAIL PROTECTED]> wrote:

> The current -rt patch changes the scheduler so that the BKL is no 
> longer properly reacquired. If SPINLOCK_BKL is selected it's possible 
> for reacquire_kernel_lock() to return without acquiring the BKL, in 
> vanilla linux the return value of that function is evaluated, but in 
> -rt that code is removed. The result is that if __schedule gets 
> recalled on TIF_NEED_RESCHED the BKL will be released unconditionally 
> ..

The patch below should fix this. This trylock-the-BKL code predates the 
semaphore-based CONFIG_PREEMPT_BKL code - and it's alot better to use 
the semaphore than to do a clever trylock loop.

        Ingo

Index: linux/lib/kernel_lock.c
===================================================================
--- linux.orig/lib/kernel_lock.c
+++ linux/lib/kernel_lock.c
@@ -128,11 +128,7 @@ static  __cacheline_aligned_in_smp DEFIN
 int __lockfunc __reacquire_kernel_lock(void)
 {
        local_irq_enable();
-       while (!_raw_spin_trylock(&kernel_flag)) {
-               if (test_thread_flag(TIF_NEED_RESCHED))
-                       return -EAGAIN;
-               cpu_relax();
-       }
+       _raw_spin_lock(&kernel_flag);
        local_irq_disable();
        preempt_disable();
        return 0;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to