lkml.org 
[lkml]   [2006]   [Nov]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
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 08:37    [W:0.070 / U:2.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site