sched/numa: Provide sysctl knob to disable numa scheduling and turn it off by default
Subsystems (2)
Commit-ID: bcdf5162b92dfc0999b0e0ecf25d778733cc4c4d Gitweb: http://git.kernel.org/tip/bcdf5162b92dfc0999b0e0ecf25d778733cc4c4d Author: Peter Zijlstra <[email protected]> AuthorDate: Thu, 17 May 2012 15:07:31 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Fri, 18 May 2012 09:48:59 +0200
sched/numa: Provide sysctl knob to disable numa scheduling and turn it off by default
Provide a knob to make all this numa scheduling go-away.
Also provide a Kconfig entry to set the default for this new knob.
Requested-by Ingo Molnar <[email protected]>
Signed-off-by Peter Zijlstra <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Andrew Morton <[email protected]>
Signed-off-by Ingo Molnar <[email protected]>
--- include/linux/sched.h | 13 +++++++ init/Kconfig | 18 ++++++++++ kernel/sched/numa.c | 89 +++++++++++++++++++++++++++++++++++++++--------- kernel/sysctl.c | 11 ++++++ 4 files changed, 114 insertions(+), 17 deletions(-)
include/linux/sched.h +13 -0
@@ -90,6 +90,7 @@ struct sched_param {#include <linux/latencytop.h> #include <linux/cred.h> #include <linux/llist.h> +#include <linux/jump_label.h> #include <asm/processor.h>
@@ -1584,9 +1585,14 @@ struct task_struct {/* Future-safe accessor for struct task_struct's cpus_allowed. */ #define tsk_cpus_allowed (tsk) (&(tsk)->cpus_allowed) +extern struct static_key sched_numa_disabled; +static inline int tsk_home_node (struct task_struct *p) {#ifdef CONFIG_NUMA +if (static_key_false (&sched_numa_disabled)) +return -1 ; +return p->node;#else return -1 ;
@@ -2058,6 +2064,13 @@ static inline void sched_autogroup_exit(struct signal_struct *sig) { }extern unsigned int sysctl_sched_cfs_bandwidth_slice;#endif +#ifdef CONFIG_NUMA +extern int sysctl_sched_numa; +int sched_numa_handler (struct ctl_table *table,int write, +void __user *buffer,size_t *lenp, +loff_t *ppos); +#endif +#ifdef CONFIG_RT_MUTEXES extern int rt_mutex_getprio (struct task_struct *p);extern void rt_mutex_setprio (struct task_struct *p,int prio);
init/Kconfig +18 -0
@@ -865,6 +865,24 @@ config SCHED_AUTOGROUP desktop applications. Task group autogeneration is currently based upon task session. +config SCHED_NUMA_DEFAULT + bool "Enable NUMA scheduling by default" + depends on NUMA + default n + help + This option selects the default enablement of a scheduler feature + that gives each process a home-node and allocates all its memory + from there and tries to schedule all the process tasks on that node + (or as near to it) while trying to maintain fairness. + + Without this feature memory is allocated on whatever node a task + happens to run on and the scheduler is free to migrate tasks around + at will -- which can result in significant cross-node memory + traffic. + + Regardless of this setting it can always be changed at runtime + by changing /proc/sys/kernel/sched_numa. + config MM_OWNER def_bool NUMA
kernel/sched/numa.c +72 -17
134 lines not on this page · raw message
kernel/sysctl.c +11 -0
@@ -373,6 +373,17 @@ static struct ctl_table kern_table[] = { .extra1 = &one, },#endif +#ifdef CONFIG_NUMA + { + .procname = "sched_numa", + .data = &sysctl_sched_numa, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = sched_numa_handler, + .extra1 = &zero, + .extra2 = &one, + }, +#endif #ifdef CONFIG_PROVE_LOCKING { .procname = "prove_locking",