Index: linux-2.6.23-cfs/init/Kconfig =================================================================== --- linux-2.6.23-cfs.orig/init/Kconfig +++ linux-2.6.23-cfs/init/Kconfig @@ -1,3 +1,5 @@ +source "init/Kconfig.cfs" + config DEFCONFIG_LIST string depends on !UML Index: linux-2.6.21-cfs/init/Kconfig.cfs =================================================================== --- linux-2.6.23-cfs.orig/init/Kconfig.cfs +++ linux-2.6.23-cfs/init/Kconfig.cfs @@ -0,0 +1,130 @@ +menu "Completely Fair Scheduler Tunables" + +choice + prompt "CFS predefined setups" + default INTERACTIVE_DESKTOP + +config FAIR_DESKTOP + bool "Fair Desktop/Server" + help + Fair Desktop. + Use this option if you want a stable and fair desktop. + + Privileged tasks won't be reniced and "preemption latency" won't be + modified. + +config INTERACTIVE_DESKTOP + bool "Interactive Desktop (Recommended)" + select BOOST_PRIVILEGED_TASKS + help + Interactive Desktop. + Use this option if you want a interactive desktop. + + Privileged tasks will be reniced to -10 value and "preemption latency" + will be decreased in 0.5 msec. + +config HIGHLY_INTERACTIVE_DESKTOP + bool "Highly Interactive Desktop" + select BOOST_PRIVILEGED_TASKS + help + Highly Interactive Desktop. + Use this option if you want a very high interactive desktop. + + Privileged tasks will be reniced to -19 value and "preemption latency" + will be decreased in 1 msec. + + This option is not recommended, UNLESS you have really high latencies. + +config CUSTOM_SCHED_SETUP + bool "Custom scheduler Setup" + select BOOST_PRIVILEGED_TASKS + help + Custom setup. + Manual setup of "Completely Fair Scheduler" by the user. + +endchoice + +config CUSTOM_PRIVILEGED_TASKS_NICE_VALUE + int "Custom nice value for privileged tasks" + depends CUSTOM_SCHED_SETUP + range -20 20 + default -10 + help + Privileged tasks default nice value. + +config CUSTOM_SCHED_LATENCY + int "Custom targeted preemption latency" + depends CUSTOM_SCHED_SETUP + range 0 100000 + default 20000 + help + Targeted preemption latency value (in microseconds). + +config CUSTOM_SCHED_MIN_GRANULARITY + int "Custom minimal preemption granularity" + depends CUSTOM_SCHED_SETUP + range 0 10000 + default 2000 + help + Minimal targeted preemption latency value (in microseconds). + +config CUSTOM_SCHED_WAKEUP_GRANULARITY + int "Custom SCHED_OTHER wakeup granularity" + depends CUSTOM_SCHED_SETUP + range 0 100000 + default 1000 + help + SCHED_OTHER wakeup granularity value (in microseconds). + +config CUSTOM_SCHED_BATCH_WAKEUP_GRANULARITY + int "Custom SCHED_BATCH wakeup granularity" + depends CUSTOM_SCHED_SETUP + range 0 100000 + default 25000 + help + SCHED_BATCH wakeup granularity value (in microseconds). + +config SYSCTL_PRIVILEGED_NICE_LEVEL + bool "Change privileged tasks nice level through sysctl" + default n + help + If this option is enabled, a file called "sched_privileged_nice_level" will be created + on /proc/sys/kernel that will allow to modify the privileged tasks priority. + + This *ONLY* will take effect on tasks that are executed after the change. + +endmenu + +config PRIVILEGED_TASKS_NICE_LEVEL + int + default 0 if FAIR_DESKTOP + default -10 if INTERACTIVE_DESKTOP + default -19 if HIGHLY_INTERACTIVE_DESKTOP + default CUSTOM_PRIVILEGED_TASKS_NICE_VALUE if CUSTOM_SCHED_SETUP + +config SCHED_LATENCY + int + default 20000 if FAIR_DESKTOP + default 15000 if INTERACTIVE_DESKTOP + default 10000 if HIGHLY_INTERACTIVE_DESKTOP + default CUSTOM_SCHED_LATENCY if CUSTOM_SCHED_SETUP + +config SCHED_MIN_GRANULARITY + int + default 2000 if FAIR_DESKTOP + default 1500 if INTERACTIVE_DESKTOP + default 1000 if HIGHLY_INTERACTIVE_DESKTOP + default CUSTOM_SCHED_MIN_GRANULARITY if CUSTOM_SCHED_SETUP + +config SCHED_WAKEUP_GRANULARITY + int + default 1000 if FAIR_DESKTOP + default 500 if INTERACTIVE_DESKTOP + default 100 if HIGHLY_INTERACTIVE_DESKTOP + default CUSTOM_SCHED_WAKEUP_GRANULARITY if CUSTOM_SCHED_SETUP + +config SCHED_BATCH_WAKEUP_GRANULARITY + int + default 25000 if FAIR_DESKTOP + default 20000 if INTERACTIVE_DESKTOP + default 15000 if HIGHLY_INTERACTIVE_DESKTOP + default CUSTOM_SCHED_BATCH_WAKEUP_GRANULARITY if CUSTOM_SCHED_SETUP Index: linux-2.6.23-cfs/kernel/sched.c =================================================================== --- linux-2.6.23-cfs.orig/kernel/sched.c +++ linux-2.6.23-cfs/kernel/sched.c @@ -3326,7 +3326,8 @@ * Nice level for privileged tasks. (can be set to 0 for this * to be turned off) */ -int sysctl_sched_privileged_nice_level __read_mostly = -10; +int sysctl_sched_privileged_nice_level __read_mostly = + CONFIG_PRIVILEGED_TASKS_NICE_LEVEL; static int __init privileged_nice_level_setup(char *str) { Index: linux-2.6.23-cfs/kernel/sched_fair.c =================================================================== --- linux-2.6.23-cfs.orig/kernel/sched_fair.c +++ linux-2.6.23-cfs/kernel/sched_fair.c @@ -34,13 +34,15 @@ * systems, 4x on 8-way systems, 5x on 16-way systems, etc.) * Targeted preemption latency for CPU-bound tasks: */ -unsigned int sysctl_sched_latency __read_mostly = 20000000ULL; +unsigned int sysctl_sched_latency __read_mostly = + CONFIG_SCHED_LATENCY * 1000ULL; /* * Minimal preemption granularity for CPU-bound tasks: * (default: 2 msec, units: nanoseconds) */ -unsigned int sysctl_sched_min_granularity __read_mostly = 2000000ULL; +unsigned int sysctl_sched_min_granularity __read_mostly = + CONFIG_SCHED_MIN_GRANULARITY * 1000ULL; /* * sys_sched_yield() compat mode @@ -58,7 +60,8 @@ * and reduces their over-scheduling. Synchronous workloads will still * have immediate wakeup/sleep latencies. */ -unsigned int sysctl_sched_batch_wakeup_granularity __read_mostly = 25000000UL; +unsigned int sysctl_sched_batch_wakeup_granularity __read_mostly = + CONFIG_SCHED_BATCH_WAKEUP_GRANULARITY * 1000UL; /* * SCHED_OTHER wake-up granularity. @@ -68,7 +71,8 @@ * and reduces their over-scheduling. Synchronous workloads will still * have immediate wakeup/sleep latencies. */ -unsigned int sysctl_sched_wakeup_granularity __read_mostly = 1000000UL; +unsigned int sysctl_sched_wakeup_granularity __read_mostly = + CONFIG_SCHED_WAKEUP_GRANULARITY * 1000UL; unsigned int sysctl_sched_stat_granularity __read_mostly; Index: linux-2.6.23-cfs/kernel/sysctl.c =================================================================== --- linux-2.6.23-cfs.orig/kernel/sysctl.c +++ linux-2.6.23-cfs/kernel/sysctl.c @@ -123,5 +123,9 @@ #ifdef CONFIG_RT_MUTEXES extern int max_lock_depth; #endif + +#ifdef CONFIG_SYSCTL_PRIVILEGED_TASKS_NICE_LEVEL +extern int sysctl_sched_privileged_nice_level; +#endif #ifdef CONFIG_SYSCTL_SYSCALL @@ -594,6 +598,17 @@ .mode = 0444, .proc_handler = &proc_dointvec, }, +#if defined(CONFIG_SYSCTL_PRIVILEGED_TASKS_NICE_LEVEL) + { + .ctl_name = CTL_UNNUMBERED, + .procname = "sched_privileged_nice_level", + .data = &sysctl_sched_privileged_nice_level, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_dointvec_minmax, + .strategy = &sysctl_intvec, + }, +#endif #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) { .ctl_name = KERN_UNKNOWN_NMI_PANIC,