diff options
| author | Andi Kleen <ak@linux.intel.com> | 2014-01-23 18:53:13 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-23 19:36:51 -0500 |
| commit | 54a43d54988a3731d644fdeb7a1d6f46b4ac64c7 (patch) | |
| tree | 87dc618d08b23d042e3ea01b3acbc56a0358cbdb /kernel | |
| parent | 5e270e254885893f8c82ab9b91caa648af3690df (diff) | |
numa: add a sysctl for numa_balancing
Add a working sysctl to enable/disable automatic numa memory balancing
at runtime.
This allows us to track down performance problems with this feature and
is generally a good idea.
This was possible earlier through debugfs, but only with special
debugging options set. Also fix the boot message.
[akpm@linux-foundation.org: s/sched_numa_balancing/sysctl_numa_balancing/]
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Mel Gorman <mgorman@suse.de>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/sched/core.c | 24 | ||||
| -rw-r--r-- | kernel/sysctl.c | 9 |
2 files changed, 32 insertions, 1 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 4d6964e49711..7fea865a810d 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
| @@ -1770,7 +1770,29 @@ void set_numabalancing_state(bool enabled) | |||
| 1770 | numabalancing_enabled = enabled; | 1770 | numabalancing_enabled = enabled; |
| 1771 | } | 1771 | } |
| 1772 | #endif /* CONFIG_SCHED_DEBUG */ | 1772 | #endif /* CONFIG_SCHED_DEBUG */ |
| 1773 | #endif /* CONFIG_NUMA_BALANCING */ | 1773 | |
| 1774 | #ifdef CONFIG_PROC_SYSCTL | ||
| 1775 | int sysctl_numa_balancing(struct ctl_table *table, int write, | ||
| 1776 | void __user *buffer, size_t *lenp, loff_t *ppos) | ||
| 1777 | { | ||
| 1778 | struct ctl_table t; | ||
| 1779 | int err; | ||
| 1780 | int state = numabalancing_enabled; | ||
| 1781 | |||
| 1782 | if (write && !capable(CAP_SYS_ADMIN)) | ||
| 1783 | return -EPERM; | ||
| 1784 | |||
| 1785 | t = *table; | ||
| 1786 | t.data = &state; | ||
| 1787 | err = proc_dointvec_minmax(&t, write, buffer, lenp, ppos); | ||
| 1788 | if (err < 0) | ||
| 1789 | return err; | ||
| 1790 | if (write) | ||
| 1791 | set_numabalancing_state(state); | ||
| 1792 | return err; | ||
| 1793 | } | ||
| 1794 | #endif | ||
| 1795 | #endif | ||
| 1774 | 1796 | ||
| 1775 | /* | 1797 | /* |
| 1776 | * fork()/clone()-time setup: | 1798 | * fork()/clone()-time setup: |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 332cefcdb04b..693eac39c202 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
| @@ -389,6 +389,15 @@ static struct ctl_table kern_table[] = { | |||
| 389 | .mode = 0644, | 389 | .mode = 0644, |
| 390 | .proc_handler = proc_dointvec, | 390 | .proc_handler = proc_dointvec, |
| 391 | }, | 391 | }, |
| 392 | { | ||
| 393 | .procname = "numa_balancing", | ||
| 394 | .data = NULL, /* filled in by handler */ | ||
| 395 | .maxlen = sizeof(unsigned int), | ||
| 396 | .mode = 0644, | ||
| 397 | .proc_handler = sysctl_numa_balancing, | ||
| 398 | .extra1 = &zero, | ||
| 399 | .extra2 = &one, | ||
| 400 | }, | ||
| 392 | #endif /* CONFIG_NUMA_BALANCING */ | 401 | #endif /* CONFIG_NUMA_BALANCING */ |
| 393 | #endif /* CONFIG_SCHED_DEBUG */ | 402 | #endif /* CONFIG_SCHED_DEBUG */ |
| 394 | { | 403 | { |
