Re: -rt patch scheduler w/ BKL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux