summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2003-09-21 01:38:24 -0700
committerLinus Torvalds <torvalds@home.osdl.org>2003-09-21 01:38:24 -0700
commit2cf13d58dbc43af21ad54ccbf1081f0757818b71 (patch)
treecb40b4112327ac56c738ff7e4a609da17c63b4fa /include/linux
parent875ee1e15641e6662264f9279b12cba1f1d3c4fc (diff)
[PATCH] CPU scheduler interactivity changes
From: Con Kolivas <kernel@kolivas.org> Interactivity scheduler tweaks on top of Ingo's A3 interactivity patch. Interactive credit added to task struct to find truly interactive tasks and treat them differently. Extra #defines included as helpers for conversion to/from nanosecond timing, to work out an average timeslice for nice 0 tasks, and the effective dynamic priority bonuses that will be given to tasks. MAX_SLEEP_AVG modified to change dynamic priority by one for a nice 0 task sleeping or running for one full timeslice. CREDIT_LIMIT is the number of times a task earns sleep_avg over MAX_SLEEP_AVG before it is considered HIGH_CREDIT (truly interactive); and -CREDIT_LIMIT is LOW_CREDIT TIMESLICE GRANULARITY is modified to be more frequent for more interactivetasks (10 ms for top 2 dynamic priorities and then halving each priority belowthat) and less frequent per extra cpu. JUST_INTERACTIVE_SLEEP logic created to be a sleep_avg consistent with giving a task enough dynamic priority to remain on the active array. Task preemption of equal priority tasks is dropped as requeuing with TIMESLICE_GRANULARITY makes this unecessary. Dynamic priority bonus simplified. User tasks that sleep a long time and not waking from uninterruptible sleep are sought and categorised as idle. Their sleep avg is limited in it's rise to prevent them becoming high priority and suddenly turning into cpu hogs. Bonus for sleeping is proportionately higher the lower the dynamic priority of a task is; this allows for very rapid escalation to interactive status. Tasks that are LOW_CREDIT are limited in rise per sleep to one priority level. Non HIGH_CREDIT tasks waking from uninterruptible sleep are sought to detect cpu hogs waiting on I/O and their sleep_avg rise is limited to just interactive state to prevent cpu bound tasks from becoming interactive during I/O wait. Tasks that earn sleep_avg over MAX_SLEEP_AVG get interactive credits. On runqueue bonus is not given to non HIGH_CREDIT tasks waking from uninterruptible sleep. Forked tasks and their parents get sleep_avg limited to the minimum necessary to maintain their effective dynamic priority thus preventing repeated forking from being a way to get highly interactive, but not penalise them noticably otherwise. CAN_MIGRATE_TASK cleaned up and modified to work with nanosecond timestamps. Reverted Ingo's A3 Starvation limit change - it was making interactive tasks suffer more under increasing load. If a cpu is grossly overloaded and everyone is going to starve it may as well run interactive tasks preferentially. Task requeuing is limited to interactive tasks only (cpu bound tasks dont need low latency and derive benefit from longer timeslices), and they must have at least TIMESLICE_GRANULARITY remaining. HIGH_CREDIT tasks get penalised less sleep_avg the more interactive they are thus keeping them interactive for bursts but if they become sustained cpu hogs they will slide increasingly rapidly down the dynamic priority scale. Tasks that run out of sleep_avg, are still using up cpu time and are not high or low credit yet get penalised interactive credits to determine LOW_CREDIT tasks (cpu bound ones).
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/sched.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index d2d412d96bea..1618ae7f42d4 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -342,6 +342,7 @@ struct task_struct {
prio_array_t *array;
unsigned long sleep_avg;
+ long interactive_credit;
unsigned long long timestamp;
int activated;