diff options
author | Mel Gorman <mgorman@suse.de> | 2012-11-22 06:16:36 -0500 |
---|---|---|
committer | Mel Gorman <mgorman@suse.de> | 2012-12-11 09:42:55 -0500 |
commit | 1a687c2e9a99335c9e77392f050fe607fa18a652 (patch) | |
tree | 06df958bfdfeaf9f38f333af106b55faa81f1c6b /mm/mempolicy.c | |
parent | b8593bfda1652755136333cdd362de125b283a9c (diff) |
mm: sched: numa: Control enabling and disabling of NUMA balancing
This patch adds Kconfig options and kernel parameters to allow the
enabling and disabling of automatic NUMA balancing. The existance
of such a switch was and is very important when debugging problems
related to transparent hugepages and we should have the same for
automatic NUMA placement.
Signed-off-by: Mel Gorman <mgorman@suse.de>
Diffstat (limited to 'mm/mempolicy.c')
-rw-r--r-- | mm/mempolicy.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index fd20e28fd2ad..046308e9b999 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -2521,6 +2521,50 @@ void mpol_free_shared_policy(struct shared_policy *p) | |||
2521 | mutex_unlock(&p->mutex); | 2521 | mutex_unlock(&p->mutex); |
2522 | } | 2522 | } |
2523 | 2523 | ||
2524 | #ifdef CONFIG_NUMA_BALANCING | ||
2525 | static bool __initdata numabalancing_override; | ||
2526 | |||
2527 | static void __init check_numabalancing_enable(void) | ||
2528 | { | ||
2529 | bool numabalancing_default = false; | ||
2530 | |||
2531 | if (IS_ENABLED(CONFIG_NUMA_BALANCING_DEFAULT_ENABLED)) | ||
2532 | numabalancing_default = true; | ||
2533 | |||
2534 | if (nr_node_ids > 1 && !numabalancing_override) { | ||
2535 | printk(KERN_INFO "Enabling automatic NUMA balancing. " | ||
2536 | "Configure with numa_balancing= or sysctl"); | ||
2537 | set_numabalancing_state(numabalancing_default); | ||
2538 | } | ||
2539 | } | ||
2540 | |||
2541 | static int __init setup_numabalancing(char *str) | ||
2542 | { | ||
2543 | int ret = 0; | ||
2544 | if (!str) | ||
2545 | goto out; | ||
2546 | numabalancing_override = true; | ||
2547 | |||
2548 | if (!strcmp(str, "enable")) { | ||
2549 | set_numabalancing_state(true); | ||
2550 | ret = 1; | ||
2551 | } else if (!strcmp(str, "disable")) { | ||
2552 | set_numabalancing_state(false); | ||
2553 | ret = 1; | ||
2554 | } | ||
2555 | out: | ||
2556 | if (!ret) | ||
2557 | printk(KERN_WARNING "Unable to parse numa_balancing=\n"); | ||
2558 | |||
2559 | return ret; | ||
2560 | } | ||
2561 | __setup("numa_balancing=", setup_numabalancing); | ||
2562 | #else | ||
2563 | static inline void __init check_numabalancing_enable(void) | ||
2564 | { | ||
2565 | } | ||
2566 | #endif /* CONFIG_NUMA_BALANCING */ | ||
2567 | |||
2524 | /* assumes fs == KERNEL_DS */ | 2568 | /* assumes fs == KERNEL_DS */ |
2525 | void __init numa_policy_init(void) | 2569 | void __init numa_policy_init(void) |
2526 | { | 2570 | { |
@@ -2571,6 +2615,8 @@ void __init numa_policy_init(void) | |||
2571 | 2615 | ||
2572 | if (do_set_mempolicy(MPOL_INTERLEAVE, 0, &interleave_nodes)) | 2616 | if (do_set_mempolicy(MPOL_INTERLEAVE, 0, &interleave_nodes)) |
2573 | printk("numa_policy_init: interleaving failed\n"); | 2617 | printk("numa_policy_init: interleaving failed\n"); |
2618 | |||
2619 | check_numabalancing_enable(); | ||
2574 | } | 2620 | } |
2575 | 2621 | ||
2576 | /* Reset policy of current process to default */ | 2622 | /* Reset policy of current process to default */ |