diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-05-04 18:07:35 -0400 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-05-04 18:07:35 -0400 |
commit | 6b06d1ce233787655eb21b624ed924806768b36c (patch) | |
tree | c0ffcd31b0831719615e83b63b2022d41faf6208 /kernel | |
parent | 9b4ccbc27ea5d1a35e79391ca5a500b32cd253a1 (diff) |
LITMUS: avoid using the same stack on two CPUs in global schedulers
This change fixes a race where a job could be executed on more than one
CPU, which to random crashes.
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 441996e08c..d9e876fea8 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -1897,6 +1897,7 @@ static void finish_task_switch(struct rq *rq, struct task_struct *prev) | |||
1897 | finish_arch_switch(prev); | 1897 | finish_arch_switch(prev); |
1898 | litmus->finish_switch(prev); | 1898 | litmus->finish_switch(prev); |
1899 | finish_lock_switch(rq, prev); | 1899 | finish_lock_switch(rq, prev); |
1900 | prev->rt_param.stack_in_use = NO_CPU; | ||
1900 | fire_sched_in_preempt_notifiers(current); | 1901 | fire_sched_in_preempt_notifiers(current); |
1901 | if (mm) | 1902 | if (mm) |
1902 | mmdrop(mm); | 1903 | mmdrop(mm); |
@@ -3679,6 +3680,7 @@ need_resched_nonpreemptible: | |||
3679 | rq->curr = next; | 3680 | rq->curr = next; |
3680 | ++*switch_count; | 3681 | ++*switch_count; |
3681 | 3682 | ||
3683 | TRACE_TASK(next, "switched to\n"); | ||
3682 | context_switch(rq, prev, next); /* unlocks the rq */ | 3684 | context_switch(rq, prev, next); /* unlocks the rq */ |
3683 | } else | 3685 | } else |
3684 | spin_unlock_irq(&rq->lock); | 3686 | spin_unlock_irq(&rq->lock); |
@@ -4391,8 +4393,10 @@ recheck: | |||
4391 | oldprio = p->prio; | 4393 | oldprio = p->prio; |
4392 | __setscheduler(rq, p, policy, param->sched_priority); | 4394 | __setscheduler(rq, p, policy, param->sched_priority); |
4393 | 4395 | ||
4394 | if (policy == SCHED_LITMUS) | 4396 | if (policy == SCHED_LITMUS) { |
4397 | p->rt_param.stack_in_use = running ? rq->cpu : NO_CPU; | ||
4395 | litmus->task_new(p, on_rq, running); | 4398 | litmus->task_new(p, on_rq, running); |
4399 | } | ||
4396 | 4400 | ||
4397 | if (on_rq) { | 4401 | if (on_rq) { |
4398 | if (running) | 4402 | if (running) |