summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2003-05-18 20:46:39 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2003-05-18 20:46:39 -0700
commite7778aa6f31831fddb810517f950ba87787dfedd (patch)
tree6a2ced90815183591c771953c79d042ed37e7d72
parent84205d0528f386e99ec00cd378acb3c4df010643 (diff)
[PATCH] Fix lost scheduler rebalances
This fixes a race noticed by Mike Galbraith: the scheduler can lose a rebalance tick if some task happens to not be rescheduled in time. This is not a fatal condition, but an inconsistency nevertheless.
-rw-r--r--kernel/sched.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index a699eb066551..f9dc0a968a61 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1180,7 +1180,7 @@ void scheduler_tick(int user_ticks, int sys_ticks)
/* Task might have expired already, but not scheduled off yet */
if (p->array != rq->active) {
set_tsk_need_resched(p);
- return;
+ goto out;
}
spin_lock(&rq->lock);
/*
@@ -1207,7 +1207,7 @@ void scheduler_tick(int user_ticks, int sys_ticks)
dequeue_task(p, rq->active);
enqueue_task(p, rq->active);
}
- goto out;
+ goto out_unlock;
}
if (!--p->time_slice) {
dequeue_task(p, rq->active);
@@ -1223,8 +1223,9 @@ void scheduler_tick(int user_ticks, int sys_ticks)
} else
enqueue_task(p, rq->active);
}
-out:
+out_unlock:
spin_unlock(&rq->lock);
+out:
rebalance_tick(rq, 0);
}