LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Davide Libenzi <davidel@xmailserver.org>
Cc: 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:05:38 +0200 [thread overview]
Message-ID: <20040524090538.GA26183@elte.hu> (raw)
In-Reply-To: <Pine.LNX.4.58.0405232340070.2676@bigblue.dev.mdolabs.com>
* Davide Libenzi <davidel@xmailserver.org> wrote:
> We used to do it in 2.4. What changed to make it fragile? The
> threading (TLS) thing?
it _should_ work, but in the past we only had trouble from such changes
(at least in the O(1) tree of scheduling - 2.4 scheduler is OK.). We
could try the patch below. It certainly boots on SMP x86. But it causes
a 3.5% slowdown in lat_ctx so i'd not do it unless there are some really
good reasons.
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(&(rq)->lock); \
+ } while (0)
+# define finish_arch_switch(rq, prev) \
+ spin_unlock_irq(&(prev)->switch_lock)
+# define task_running(rq, p) \
+ ((rq)->curr == (p) || spin_is_locked(&(p)->switch_lock))
#endif
/*
next prev parent reply other threads:[~2004-05-24 7:04 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 [this message]
2004-05-24 7:10 ` Nick Piggin
2004-05-24 9:15 ` Ingo Molnar
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=20040524090538.GA26183@elte.hu \
--to=mingo@elte.hu \
--cc=davidel@xmailserver.org \
--cc=linux-kernel@vger.kernel.org \
--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).