linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] sched-rebalance-fix-2.5.69-A1
@ 2003-05-19  8:43 Ingo Molnar
  0 siblings, 0 replies; only message in thread
From: Ingo Molnar @ 2003-05-19  8:43 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, Mike Galbraith


the attached patch 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.

	Ingo

--- linux/kernel/sched.c.orig	
+++ linux/kernel/sched.c	
@@ -1180,7 +1180,7 @@ void scheduler_tick(int user_ticks, int 
 	/* 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 
 			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 
 		} else
 			enqueue_task(p, rq->active);
 	}
-out:
+out_unlock:
 	spin_unlock(&rq->lock);
+out:
 	rebalance_tick(rq, 0);
 }
 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-05-19  8:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-19  8:43 [patch] sched-rebalance-fix-2.5.69-A1 Ingo Molnar

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).