From: David Mosberger <davidm@hpl.hp.com>
To: linux-ia64@vger.kernel.org
Subject: Re: [Linux-ia64] Help with Ingo scheduler on IA64
Date: Thu, 17 Jan 2002 01:42:30 +0000 [thread overview]
Message-ID: <marc-linux-ia64-105590698805863@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-105590698805816@msgid-missing>
In case you're still fighting with Ingo's scheduler on 2.4.xx, you
might want to try the attached patch. It's a gross hack to work
around a race condition in set_cpus_allowed(). Without this hack, the
kernel would almost always die as soon as it tried to migrate
ksoftirqd_CPU1 from CPU 0 to CPU 1. With the patch, it boots up to
the point where the serial line driver gets initialized, which is
progress, I suppose.
The fundamental problem is that current set_cpus_allowed() lets the
same task run on two CPUs for a brief period of time. This violates
scheduling assumptions made by the kernel and hence results in race
conditions.
--david
--- linux-2.5.2/kernel/sched.c Tue Jan 15 22:10:27 2002
+++ lia64-kdb/kernel/sched.c Wed Jan 16 17:24:39 2002
@@ -230,7 +230,7 @@
spin_unlock_irq(&this_rq()->lock);
}
-static inline void context_switch(task_t *prev, task_t *next)
+static inline void context_switch(task_t *prev, task_t *next, int dont_clear)
{
struct mm_struct *mm = next->mm;
struct mm_struct *oldmm = prev->active_mm;
@@ -245,7 +245,8 @@
switch_mm(oldmm, mm, next, smp_processor_id());
if (!prev->mm) {
- prev->active_mm = NULL;
+ if (!dont_clear)
+ prev->active_mm = NULL;
mmdrop(oldmm);
}
@@ -519,7 +520,7 @@
rq->nr_switches++;
rq->curr = next;
next->cpu = prev->cpu;
- context_switch(prev, next);
+ context_switch(prev, next, 0);
/*
* The runqueue pointer might be from another CPU
* if the new task was last running on a different
@@ -721,7 +722,7 @@
this_rq->nr_switches++;
this_rq->curr = this_rq->idle;
this_rq->idle->need_resched = 1;
- context_switch(current, this_rq->idle);
+ context_switch(current, this_rq->idle, 1);
barrier();
spin_unlock_irq(&this_rq()->lock);
}
next prev parent reply other threads:[~2002-01-17 1:42 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-01-12 2:23 [Linux-ia64] Help with Ingo scheduler on IA64 Nick Pollitt
2002-01-12 3:13 ` David Mosberger
2002-01-14 18:23 ` Erich Focht
2002-01-15 1:07 ` Nick Pollitt
2002-01-15 9:28 ` Erich Focht
2002-01-15 17:53 ` Erich Focht
2002-01-15 17:58 ` Erich Focht
2002-01-15 18:59 ` Erich Focht
2002-01-15 19:52 ` Ingo Molnar
2002-01-15 19:57 ` Ingo Molnar
2002-01-15 20:12 ` Ingo Molnar
2002-01-16 5:30 ` Nick Pollitt
2002-01-16 21:04 ` Erich Focht
2002-01-17 1:42 ` David Mosberger [this message]
2002-01-17 5:39 ` Nick Pollitt
2002-01-17 8:06 ` David Mosberger
2002-01-17 9:43 ` Ingo Molnar
2002-01-17 9:45 ` Ingo Molnar
2002-01-17 18:25 ` Erich Focht
2002-01-17 21:17 ` Ingo Molnar
2002-01-19 17:17 ` Erich Focht
2002-01-19 20:10 ` David Mosberger
2002-01-21 16:23 ` Erich Focht
2002-01-21 18:24 ` Erich Focht
2002-01-21 18:45 ` Erich Focht
2002-01-21 20:10 ` David Mosberger
2002-01-21 20:23 ` David Mosberger
2002-01-21 20:32 ` Ingo Molnar
2002-01-21 20:41 ` David Mosberger
2002-01-21 21:11 ` Ingo Molnar
2002-01-21 22:11 ` Ingo Molnar
2002-01-21 22:27 ` Ingo Molnar
2002-01-21 22:30 ` Ingo Molnar
2002-01-21 22:41 ` Ingo Molnar
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=marc-linux-ia64-105590698805863@msgid-missing \
--to=davidm@hpl.hp.com \
--cc=linux-ia64@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