LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Davide Libenzi <davidel@xmailserver.org>,
	Linux Kernel List <linux-kernel@vger.kernel.org>,
	rmk+lkml@arm.linux.org.uk
Subject: Re: scheduler: IRQs disabled over context switches
Date: Mon, 24 May 2004 11:15:04 +0200	[thread overview]
Message-ID: <20040524091504.GC26183@elte.hu> (raw)
In-Reply-To: <40B19FF8.2050402@yahoo.com.au>


* Nick Piggin <nickpiggin@yahoo.com.au> wrote:

> >+# define prepare_arch_switch(rq, next)				\
> >+		do {						\
> >+			spin_lock(&(next)->switch_lock);	\
> >+			spin_unlock(&(rq)->lock);		\
> 
> spin_unlock_irq?

and spin_unlock in the finish_arch_switch() case, instead of
spin_unlock_irq. New patch below.

	Ingo

--- linux/kernel/sched.c.orig	
+++ linux/kernel/sched.c	
@@ -247,9 +247,15 @@ static DEFINE_PER_CPU(struct runqueue, r
  * Default context-switch locking:
  */
 #ifndef prepare_arch_switch
-# define prepare_arch_switch(rq, next)	do { } while (0)
-# define finish_arch_switch(rq, next)	spin_unlock_irq(&(rq)->lock)
-# define task_running(rq, p)		((rq)->curr == (p))
+# define prepare_arch_switch(rq, next)				\
+		do {						\
+			spin_lock(&(next)->switch_lock);	\
+			spin_unlock_irq(&(rq)->lock);		\
+		} while (0)
+# define finish_arch_switch(rq, prev) \
+		spin_unlock(&(prev)->switch_lock)
+# define task_running(rq, p) \
+		((rq)->curr == (p) || spin_is_locked(&(p)->switch_lock))
 #endif
 
 /*

  reply	other threads:[~2004-05-24  7:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-23 16:43 Russell King
2004-05-23 18:59 ` Davide Libenzi
2004-05-23 19:38   ` Russell King
2004-05-23 23:04     ` Davide Libenzi
2004-05-23 23:33       ` Russell King
2004-05-24  0:27         ` Davide Libenzi
2004-05-24  8:37 ` Ingo Molnar
2004-05-24  6:41   ` Davide Libenzi
2004-05-24  9:05     ` Ingo Molnar
2004-05-24  7:10       ` Nick Piggin
2004-05-24  9:15         ` Ingo Molnar [this message]
2004-05-24 17:16       ` Davide Libenzi
2004-05-24 17:46         ` Davide Libenzi

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=20040524091504.GC26183@elte.hu \
    --to=mingo@elte.hu \
    --cc=davidel@xmailserver.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    --cc=rmk+lkml@arm.linux.org.uk \
    --subject='Re: scheduler: IRQs disabled over context switches' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).