Commit 0da6b746 authored by Linus Torvalds's avatar Linus Torvalds

Make the "interactive bonus" work both ways - both the process

that is actually showing interactive behaviour (sleeping) and the
process that wakes up the interative process get a bonus.

This means that processes that help interactive processes (usually
system daemons, and X11 in particular) will themselves get some bonus.

The waker only gets whatever is left over from the "real" interactive
user, to avoid any bad behaviour.
parent e2349697
......@@ -337,8 +337,15 @@ static inline void activate_task(task_t *p, runqueue_t *rq)
* boost gets as well.
*/
p->sleep_avg += sleep_time;
if (p->sleep_avg > MAX_SLEEP_AVG)
if (p->sleep_avg > MAX_SLEEP_AVG) {
int ticks = p->sleep_avg - MAX_SLEEP_AVG + current->sleep_avg;
p->sleep_avg = MAX_SLEEP_AVG;
if (ticks > MAX_SLEEP_AVG)
ticks = MAX_SLEEP_AVG;
if (!in_interrupt())
current->sleep_avg = ticks;
}
p->prio = effective_prio(p);
}
enqueue_task(p, array);
......
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