lkml.org 
[lkml]   [2006]   [Nov]   [17]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateFri, 17 Nov 2006 07:59:22 +0100
FromIngo Molnar <>
SubjectRe: -rt patch scheduler w/ BKL
* Daniel Walker <dwalker@mvista.com> 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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2006-11-17 07:37    [from the cache]
©2003-2008