aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/sched.h1
-rw-r--r--kernel/sched/core.c2
-rw-r--r--kernel/sched/fair.c5
-rw-r--r--kernel/sysctl.c7
4 files changed, 14 insertions, 1 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 37841958d234..7d95a232b5b9 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2006,6 +2006,7 @@ enum sched_tunable_scaling {
2006}; 2006};
2007extern enum sched_tunable_scaling sysctl_sched_tunable_scaling; 2007extern enum sched_tunable_scaling sysctl_sched_tunable_scaling;
2008 2008
2009extern unsigned int sysctl_numa_balancing_scan_delay;
2009extern unsigned int sysctl_numa_balancing_scan_period_min; 2010extern unsigned int sysctl_numa_balancing_scan_period_min;
2010extern unsigned int sysctl_numa_balancing_scan_period_max; 2011extern unsigned int sysctl_numa_balancing_scan_period_max;
2011extern unsigned int sysctl_numa_balancing_scan_size; 2012extern unsigned int sysctl_numa_balancing_scan_size;
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index cad0d092ce3b..fbfc4843063f 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1543,7 +1543,7 @@ static void __sched_fork(struct task_struct *p)
1543 p->node_stamp = 0ULL; 1543 p->node_stamp = 0ULL;
1544 p->numa_scan_seq = p->mm ? p->mm->numa_scan_seq : 0; 1544 p->numa_scan_seq = p->mm ? p->mm->numa_scan_seq : 0;
1545 p->numa_migrate_seq = p->mm ? p->mm->numa_scan_seq - 1 : 0; 1545 p->numa_migrate_seq = p->mm ? p->mm->numa_scan_seq - 1 : 0;
1546 p->numa_scan_period = sysctl_numa_balancing_scan_period_min; 1546 p->numa_scan_period = sysctl_numa_balancing_scan_delay;
1547 p->numa_work.next = &p->numa_work; 1547 p->numa_work.next = &p->numa_work;
1548#endif /* CONFIG_NUMA_BALANCING */ 1548#endif /* CONFIG_NUMA_BALANCING */
1549} 1549}
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index f6e1f25ed2bd..7727b0161579 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -788,6 +788,9 @@ unsigned int sysctl_numa_balancing_scan_period_max = 100*16;
788/* Portion of address space to scan in MB */ 788/* Portion of address space to scan in MB */
789unsigned int sysctl_numa_balancing_scan_size = 256; 789unsigned int sysctl_numa_balancing_scan_size = 256;
790 790
791/* Scan @scan_size MB every @scan_period after an initial @scan_delay in ms */
792unsigned int sysctl_numa_balancing_scan_delay = 1000;
793
791static void task_numa_placement(struct task_struct *p) 794static void task_numa_placement(struct task_struct *p)
792{ 795{
793 int seq = ACCESS_ONCE(p->mm->numa_scan_seq); 796 int seq = ACCESS_ONCE(p->mm->numa_scan_seq);
@@ -929,6 +932,8 @@ void task_tick_numa(struct rq *rq, struct task_struct *curr)
929 period = (u64)curr->numa_scan_period * NSEC_PER_MSEC; 932 period = (u64)curr->numa_scan_period * NSEC_PER_MSEC;
930 933
931 if (now - curr->node_stamp > period) { 934 if (now - curr->node_stamp > period) {
935 if (!curr->node_stamp)
936 curr->numa_scan_period = sysctl_numa_balancing_scan_period_min;
932 curr->node_stamp = now; 937 curr->node_stamp = now;
933 938
934 if (!time_before(jiffies, curr->mm->numa_next_scan)) { 939 if (!time_before(jiffies, curr->mm->numa_next_scan)) {
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 7d3a2e0475e5..48a68cc258c1 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -353,6 +353,13 @@ static struct ctl_table kern_table[] = {
353#endif /* CONFIG_SMP */ 353#endif /* CONFIG_SMP */
354#ifdef CONFIG_NUMA_BALANCING 354#ifdef CONFIG_NUMA_BALANCING
355 { 355 {
356 .procname = "numa_balancing_scan_delay_ms",
357 .data = &sysctl_numa_balancing_scan_delay,
358 .maxlen = sizeof(unsigned int),
359 .mode = 0644,
360 .proc_handler = proc_dointvec,
361 },
362 {
356 .procname = "numa_balancing_scan_period_min_ms", 363 .procname = "numa_balancing_scan_period_min_ms",
357 .data = &sysctl_numa_balancing_scan_period_min, 364 .data = &sysctl_numa_balancing_scan_period_min,
358 .maxlen = sizeof(unsigned int), 365 .maxlen = sizeof(unsigned int),