From 0da6b7464fd04927ac7ea2407114e04305307b42 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Wed, 5 Mar 2003 20:59:29 -0800 Subject: [PATCH] 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. --- kernel/sched.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kernel/sched.c b/kernel/sched.c index ad1ac7be565a1..0f755481d6760 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -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); -- 2.53.0