Commit e72ff0bb authored by Con Kolivas's avatar Con Kolivas Committed by Linus Torvalds

[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: default avatarCon Kolivas <kernel@kolivas.org>
Acked-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent e7c38cb4
...@@ -700,14 +700,19 @@ static int recalc_task_prio(task_t *p, unsigned long long now) ...@@ -700,14 +700,19 @@ static int recalc_task_prio(task_t *p, unsigned long long now)
if (likely(sleep_time > 0)) { if (likely(sleep_time > 0)) {
/* /*
* User tasks that sleep a long time are categorised as * User tasks that sleep a long time are categorised as
* idle and will get just interactive status to stay active & * idle. They will only have their sleep_avg increased to a
* prevent them suddenly becoming cpu hogs and starving * level that makes them just interactive priority to stay
* other processes. * active yet prevent them suddenly becoming cpu hogs and
* starving other processes.
*/ */
if (p->mm && p->sleep_type != SLEEP_NONINTERACTIVE && if (p->mm && p->sleep_type != SLEEP_NONINTERACTIVE &&
sleep_time > INTERACTIVE_SLEEP(p)) { sleep_time > INTERACTIVE_SLEEP(p)) {
p->sleep_avg = JIFFIES_TO_NS(MAX_SLEEP_AVG - unsigned long ceiling;
DEF_TIMESLICE);
ceiling = JIFFIES_TO_NS(MAX_SLEEP_AVG -
DEF_TIMESLICE);
if (p->sleep_avg < ceiling)
p->sleep_avg = ceiling;
} else { } else {
/* /*
* Tasks waking from uninterruptible sleep are * Tasks waking from uninterruptible sleep are
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment