Add "interactive" tunable and enable by default. The staircase-deadline cpu scheduler can be set in either purely forward-looking mode for absolutely rigid fairness and cpu distribution according to nice level, or it can allow a small per-process history to smooth out cpu usage perturbations common in interactive tasks by enabling this sysctl. While small fairness issues can arise with this enabled, overall fairness is usually still strongly maintained and starvation is never possible. Enabling this can significantly smooth out 3d graphics and games. Signed-off-by: Con Kolivas --- Documentation/sysctl/kernel.txt | 16 ++++++++++++++++ kernel/sched.c | 17 +++++++++++++++-- kernel/sysctl.c | 9 +++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) Index: linux-2.6.21-ck2/kernel/sched.c =================================================================== --- linux-2.6.21-ck2.orig/kernel/sched.c 2007-05-14 19:30:30.000000000 +1000 +++ linux-2.6.21-ck2/kernel/sched.c 2007-05-14 19:30:30.000000000 +1000 @@ -101,6 +101,7 @@ unsigned long long __attribute__((weak)) * Tunable via /proc interface. */ int rr_interval __read_mostly = 8; +int sched_interactive __read_mostly = 1; /* * This contains a bitmap for each dynamic priority level with empty slots @@ -687,6 +688,18 @@ static int first_prio_slot(struct task_s } /* + * In sched_interactive mode priority allocation occurs per process per rq + * array swap. In !sched_interactive mode all waking tasks must obey the + * current prio level of all other tasks running per array swap. + */ +static int minprio(struct rq *rq, int uprio) +{ + if (sched_interactive) + return MAX_RT_PRIO; + return rq->prio_level[uprio]; +} + +/* * Find the first unused slot by this task that is also in its prio_matrix * level. SCHED_BATCH tasks do not use the priority matrix. They only take * priority slots from their static_prio and above. @@ -714,11 +727,11 @@ static int next_entitled_slot(struct tas if (likely(p->policy != SCHED_BATCH)) array->best_static_prio = p->static_prio; } else if (p->static_prio == array->best_static_prio) { - search_prio = rq->prio_level[uprio]; + search_prio = minprio(rq, uprio); } else { int i; - search_prio = rq->prio_level[uprio]; + search_prio = minprio(rq, uprio); /* A bound O(n) function, worst case n is 40 */ for (i = array->best_static_prio; i <= p->static_prio ; i++) { if (!rq->prio_level[USER_PRIO(i)]) Index: linux-2.6.21-ck2/kernel/sysctl.c =================================================================== --- linux-2.6.21-ck2.orig/kernel/sysctl.c 2007-05-14 19:30:30.000000000 +1000 +++ linux-2.6.21-ck2/kernel/sysctl.c 2007-05-14 19:30:30.000000000 +1000 @@ -77,6 +77,7 @@ extern int sysctl_drop_caches; extern int percpu_pagelist_fraction; extern int compat_log; extern int rr_interval; +extern int sched_interactive; /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ static int maxolduid = 65535; @@ -519,6 +520,14 @@ static ctl_table kern_table[] = { .extra1 = &one, .extra2 = &five_thousand, }, + { + .ctl_name = CTL_UNNUMBERED, + .procname = "interactive", + .data = &sched_interactive, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_dointvec, + }, #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) { .ctl_name = KERN_UNKNOWN_NMI_PANIC, Index: linux-2.6.21-ck2/Documentation/sysctl/kernel.txt =================================================================== --- linux-2.6.21-ck2.orig/Documentation/sysctl/kernel.txt 2007-05-14 19:30:30.000000000 +1000 +++ linux-2.6.21-ck2/Documentation/sysctl/kernel.txt 2007-05-14 19:30:30.000000000 +1000 @@ -25,6 +25,7 @@ show up in /proc/sys/kernel: - domainname - hostname - hotplug +- interactive - java-appletviewer [ binfmt_java, obsolete ] - java-interpreter [ binfmt_java, obsolete ] - kstack_depth_to_print [ X86 only ] @@ -165,6 +166,21 @@ Default value is "/sbin/hotplug". ============================================================== +interactive: + +The staircase-deadline cpu scheduler can be set in either purely +forward-looking mode for absolutely rigid fairness and cpu distribution +according to nice level, or it can allow a small per-process history +to smooth out cpu usage perturbations common in interactive tasks by +enabling this sysctl. While small fairness issues can arise with this +enabled, overall fairness is usually still strongly maintained and +starvation is never possible. Enabling this can significantly smooth +out 3d graphics and games. + +Default value is 1 (enabled). + +============================================================== + l2cr: (PPC only) This flag controls the L2 cache of G3 processor boards. If