Re: [patch] CFS scheduler, -v7

From: Ingo Molnar
Date: Thu May 03 2007 - 04:08:00 EST



* Ingo Molnar <mingo@xxxxxxx> wrote:

> > [...] but there are still some nice issues.
> >
> > Try running 3 chew.c's, then renicing one to -10, starves others for
> > some seconds while switching prio-level. Now renice it back to 10,
> > it starves for up to 45sec.
>
> ok - to make sure i understood you correctly: does this starvation
> only occur right when you renice it (when switching prio levels), and
> it gets rectified quickly once they get over a few reschedules?

meanwhile i managed to reproduce it by following the exact steps you
described, and i've fixed the bug in my tree. Can you confirm that the
patch below fixes it for you too?

Ingo

----------------->
From: Ingo Molnar <mingo@xxxxxxx>
Subject: [patch] sched, cfs: fix starvation upon nice level switching

Al Boldi reported the following bug: when switching a CPU-intense task's
nice levels they can get unfairly starved right after the priority level
switching. The bug was that when changing the load_weight the
->wait_runtime value did not get rescaled. So clear wait_runtime when
switching nice levels.

Signed-off-by: Ingo Molnar <mingo@xxxxxxx>

Index: linux/kernel/sched.c
===================================================================
--- linux.orig/kernel/sched.c
+++ linux/kernel/sched.c
@@ -575,6 +580,7 @@ static void set_load_weight(struct task_
{
p->load_shift = get_load_shift(p);
p->load_weight = 1 << p->load_shift;
+ p->wait_runtime = 0;
}

static inline void
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/