Commit c297663c0b3930491a3cb2aba4b6e5a7159c3503

Authored by Mel Gorman
Committed by Linus Torvalds
1 parent a1c3bfb2f6

mm: numa: initialise numa balancing after jump label initialisation

The command line parsing takes place before jump labels are initialised
which generates a warning if numa_balancing= is specified and
CONFIG_JUMP_LABEL is set.

On older kernels before commit c4b2c0c5f647 ("static_key: WARN on usage
before jump_label_init was called") the kernel would have crashed.  This
patch enables automatic numa balancing later in the initialisation
process if numa_balancing= is specified.

Signed-off-by: Mel Gorman <mgorman@suse.de>
Acked-by: Rik van Riel <riel@redhat.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 11 additions and 6 deletions Side-by-side Diff

... ... @@ -2654,7 +2654,7 @@
2654 2654 }
2655 2655  
2656 2656 #ifdef CONFIG_NUMA_BALANCING
2657   -static bool __initdata numabalancing_override;
  2657 +static int __initdata numabalancing_override;
2658 2658  
2659 2659 static void __init check_numabalancing_enable(void)
2660 2660 {
2661 2661  
... ... @@ -2663,9 +2663,15 @@
2663 2663 if (IS_ENABLED(CONFIG_NUMA_BALANCING_DEFAULT_ENABLED))
2664 2664 numabalancing_default = true;
2665 2665  
  2666 + /* Parsed by setup_numabalancing. override == 1 enables, -1 disables */
  2667 + if (numabalancing_override)
  2668 + set_numabalancing_state(numabalancing_override == 1);
  2669 +
2666 2670 if (nr_node_ids > 1 && !numabalancing_override) {
2667   - printk(KERN_INFO "Enabling automatic NUMA balancing. "
2668   - "Configure with numa_balancing= or the kernel.numa_balancing sysctl");
  2671 + printk(KERN_INFO "%s automatic NUMA balancing. "
  2672 + "Configure with numa_balancing= or the "
  2673 + "kernel.numa_balancing sysctl",
  2674 + numabalancing_default ? "Enabling" : "Disabling");
2669 2675 set_numabalancing_state(numabalancing_default);
2670 2676 }
2671 2677 }
2672 2678  
2673 2679  
... ... @@ -2675,13 +2681,12 @@
2675 2681 int ret = 0;
2676 2682 if (!str)
2677 2683 goto out;
2678   - numabalancing_override = true;
2679 2684  
2680 2685 if (!strcmp(str, "enable")) {
2681   - set_numabalancing_state(true);
  2686 + numabalancing_override = 1;
2682 2687 ret = 1;
2683 2688 } else if (!strcmp(str, "disable")) {
2684   - set_numabalancing_state(false);
  2689 + numabalancing_override = -1;
2685 2690 ret = 1;
2686 2691 }
2687 2692 out: