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

[PATCH] sched: make task_noninteractive use sleep_type

Alterations to the pipe code in the kernel made it possible for relative
starvation to occur with tasks that slept waiting on a pipe getting unfair
priority bonuses even if they were otherwise fully cpu bound so the
TASK_NONINTERACTIVE flag was introduced which prevented any change to
sleep_avg while sleeping waiting on a pipe.  This change also leads to the
converse though, preventing any priority boost from occurring in truly
interactive tasks that wait on pipes.

Convert the TASK_NONINTERACTIVE flag to set sleep_type to SLEEP_NONINTERACTIVE
which will allow a linear bonus to priority based on sleep time thus allowing
interactive tasks to get high priority if they sleep enough.
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 3dee386e
...@@ -1273,18 +1273,18 @@ out_activate: ...@@ -1273,18 +1273,18 @@ out_activate:
* sleep_avg beyond just interactive state. * sleep_avg beyond just interactive state.
*/ */
p->sleep_type = SLEEP_NONINTERACTIVE; p->sleep_type = SLEEP_NONINTERACTIVE;
} } else
/* /*
* Tasks that have marked their sleep as noninteractive get * Tasks that have marked their sleep as noninteractive get
* woken up without updating their sleep average. (i.e. their * woken up with their sleep average not weighted in an
* sleep is handled in a priority-neutral manner, no priority * interactive way.
* boost and no penalty.)
*/ */
if (old_state & TASK_NONINTERACTIVE) if (old_state & TASK_NONINTERACTIVE)
__activate_task(p, rq); p->sleep_type = SLEEP_NONINTERACTIVE;
else
activate_task(p, rq, cpu == this_cpu);
activate_task(p, rq, cpu == this_cpu);
/* /*
* Sync wakeups (i.e. those types of wakeups where the waker * Sync wakeups (i.e. those types of wakeups where the waker
* has indicated that it will leave the CPU in short order) * has indicated that it will leave the CPU in short order)
......
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