aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCon Kolivas <kernel@kolivas.org>2006-03-31 05:31:26 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-31 15:18:58 -0500
commite72ff0bb2c163eb13014ba113701bd42dab382fe (patch)
tree6e4b8063442b3e020af474c2d4be124f01b0cb88
parente7c38cb49c6cc05bc11f70d9e9889da1c4a0d37f (diff)
[PATCH] sched: dont decrease idle sleep avg
We watch for tasks that sleep extended periods and don't allow one single prolonged sleep period from elevating priority to maximum bonus to prevent cpu bound tasks from getting high priority with single long sleeps. There is a bug in the current code that also penalises tasks that already have high priority. Correct that bug. Signed-off-by: Con Kolivas <kernel@kolivas.org> Acked-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--kernel/sched.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 589e55a42214..7b371931114f 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -700,14 +700,19 @@ static int recalc_task_prio(task_t *p, unsigned long long now)
700 if (likely(sleep_time > 0)) { 700 if (likely(sleep_time > 0)) {
701 /* 701 /*
702 * User tasks that sleep a long time are categorised as 702 * User tasks that sleep a long time are categorised as
703 * idle and will get just interactive status to stay active & 703 * idle. They will only have their sleep_avg increased to a
704 * prevent them suddenly becoming cpu hogs and starving 704 * level that makes them just interactive priority to stay
705 * other processes. 705 * active yet prevent them suddenly becoming cpu hogs and
706 * starving other processes.
706 */ 707 */
707 if (p->mm && p->sleep_type != SLEEP_NONINTERACTIVE && 708 if (p->mm && p->sleep_type != SLEEP_NONINTERACTIVE &&
708 sleep_time > INTERACTIVE_SLEEP(p)) { 709 sleep_time > INTERACTIVE_SLEEP(p)) {
709 p->sleep_avg = JIFFIES_TO_NS(MAX_SLEEP_AVG - 710 unsigned long ceiling;
710 DEF_TIMESLICE); 711
712 ceiling = JIFFIES_TO_NS(MAX_SLEEP_AVG -
713 DEF_TIMESLICE);
714 if (p->sleep_avg < ceiling)
715 p->sleep_avg = ceiling;
711 } else { 716 } else {
712 /* 717 /*
713 * Tasks waking from uninterruptible sleep are 718 * Tasks waking from uninterruptible sleep are