lkml.org 
[lkml]   [2004]   [May]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: scheduler: IRQs disabled over context switches

* 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

/*
-
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: 2005-03-22 14:03    [W:0.056 / U:1.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site