diff options
| author | Con Kolivas <kernel@kolivas.org> | 2005-01-07 21:46:46 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@evo.osdl.org> | 2005-01-07 21:46:46 -0800 |
| commit | 2cf52d5c5c9d81f2d158312c1ab2b6b3ec856bbb (patch) | |
| tree | 646d24698d9d12de0fc7dd8ef294fcc1b4a819f0 | |
| parent | f832cc632479a6ad4a0b59c5b53de12ae601dc40 (diff) | |
[PATCH] sched: remove_interactive_credit
Special casing tasks by interactive credit was helpful for preventing fully
cpu bound tasks from easily rising to interactive status.
However it did not select out tasks that had periods of being fully cpu
bound and then sleeping while waiting on pipes, signals etc. This led to a
more disproportionate share of cpu time.
Backing this out will no longer special case only fully cpu bound tasks,
and prevents the variable behaviour that occurs at startup before tasks
declare themseleves interactive or not, and speeds up application startup
slightly under certain circumstances. It does cost in interactivity
slightly as load rises but it is worth it for the fairness gains.
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-- | include/linux/sched.h | 1 | ||||
| -rw-r--r-- | kernel/sched.c | 46 |
2 files changed, 9 insertions, 38 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index fe3e325923a1..adcfd6e16f94 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -538,7 +538,6 @@ struct task_struct { prio_array_t *array; unsigned long sleep_avg; - long interactive_credit; unsigned long long timestamp, last_ran; int activated; diff --git a/kernel/sched.c b/kernel/sched.c index 7af48c82737f..e11c5e53994f 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -98,7 +98,6 @@ #define MAX_SLEEP_AVG (DEF_TIMESLICE * MAX_BONUS) #define STARVATION_LIMIT (MAX_SLEEP_AVG) #define NS_MAX_SLEEP_AVG (JIFFIES_TO_NS(MAX_SLEEP_AVG)) -#define CREDIT_LIMIT 100 /* * If a task is 'interactive' then we reinsert it in the active @@ -156,12 +155,6 @@ (JIFFIES_TO_NS(MAX_SLEEP_AVG * \ (MAX_BONUS / 2 + DELTA((p)) + 1) / MAX_BONUS - 1)) -#define HIGH_CREDIT(p) \ - ((p)->interactive_credit > CREDIT_LIMIT) - -#define LOW_CREDIT(p) \ - ((p)->interactive_credit < -CREDIT_LIMIT) - #define TASK_PREEMPTS_CURR(p, rq) \ ((p)->prio < (rq)->curr->prio) @@ -691,8 +684,6 @@ static void recalc_task_prio(task_t *p, unsigned long long now) sleep_time > INTERACTIVE_SLEEP(p)) { p->sleep_avg = JIFFIES_TO_NS(MAX_SLEEP_AVG - DEF_TIMESLICE); - if (!HIGH_CREDIT(p)) - p->interactive_credit++; } else { /* * The lower the sleep avg a task has the more @@ -701,19 +692,11 @@ static void recalc_task_prio(task_t *p, unsigned long long now) sleep_time *= (MAX_BONUS - CURRENT_BONUS(p)) ? : 1; /* - * Tasks with low interactive_credit are limited to - * one timeslice worth of sleep avg bonus. - */ - if (LOW_CREDIT(p) && - sleep_time > JIFFIES_TO_NS(task_timeslice(p))) - sleep_time = JIFFIES_TO_NS(task_timeslice(p)); - - /* - * Non high_credit tasks waking from uninterruptible - * sleep are limited in their sleep_avg rise as they - * are likely to be cpu hogs waiting on I/O + * Tasks waking from uninterruptible sleep are + * limited in their sleep_avg rise as they + * are likely to be waiting on I/O */ - if (p->activated == -1 && !HIGH_CREDIT(p) && p->mm) { + if (p->activated == -1 && p->mm) { if (p->sleep_avg >= INTERACTIVE_SLEEP(p)) sleep_time = 0; else if (p->sleep_avg + sleep_time >= @@ -733,11 +716,8 @@ static void recalc_task_prio(task_t *p, unsigned long long now) */ p->sleep_avg += sleep_time; - if (p->sleep_avg > NS_MAX_SLEEP_AVG) { + if (p->sleep_avg > NS_MAX_SLEEP_AVG) p->sleep_avg = NS_MAX_SLEEP_AVG; - if (!HIGH_CREDIT(p)) - p->interactive_credit++; - } } } @@ -1255,8 +1235,6 @@ void fastcall wake_up_new_task(task_t * p, unsigned long clone_flags) p->sleep_avg = JIFFIES_TO_NS(CURRENT_BONUS(p) * CHILD_PENALTY / 100 * MAX_SLEEP_AVG / MAX_BONUS); - p->interactive_credit = 0; - p->prio = effective_prio(p); if (likely(cpu == this_cpu)) { @@ -2586,12 +2564,10 @@ need_resched_nonpreemptible: run_time = NS_MAX_SLEEP_AVG; /* - * Tasks with interactive credits get charged less run_time - * at high sleep_avg to delay them losing their interactive - * status + * Tasks charged proportionately less run_time at high sleep_avg to + * delay them losing their interactive status */ - if (HIGH_CREDIT(prev)) - run_time /= (CURRENT_BONUS(prev) ? : 1); + run_time /= (CURRENT_BONUS(prev) ? : 1); spin_lock_irq(&rq->lock); @@ -2682,11 +2658,8 @@ switch_tasks: rcu_qsctr_inc(task_cpu(prev)); prev->sleep_avg -= run_time; - if ((long)prev->sleep_avg <= 0) { + if ((long)prev->sleep_avg <= 0) prev->sleep_avg = 0; - if (!(HIGH_CREDIT(prev) || LOW_CREDIT(prev))) - prev->interactive_credit--; - } prev->timestamp = prev->last_ran = now; sched_info_switch(prev, next); @@ -3708,7 +3681,6 @@ void __devinit init_idle(task_t *idle, int cpu) unsigned long flags; idle->sleep_avg = 0; - idle->interactive_credit = 0; idle->array = NULL; idle->prio = MAX_PRIO; idle->state = TASK_RUNNING; |
