mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Daniel Walker <dwalker@mvista.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: -rt patch scheduler w/ BKL
Date: Fri, 17 Nov 2006 07:59:22 +0100	[thread overview]
Message-ID: <20061117065921.GA12502@elte.hu> (raw)
In-Reply-To: <1163557533.9173.121.camel@localhost.localdomain>


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

      reply	other threads:[~2006-11-17  7:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-15  2:25 Daniel Walker
2006-11-17  6:59 ` Ingo Molnar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061117065921.GA12502@elte.hu \
    --to=mingo@elte.hu \
    --cc=dwalker@mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome