Skip to content

Commit

Permalink
mm: numa: initialise numa balancing after jump label initialisation
Browse files Browse the repository at this point in the history
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 c4b2c0c ("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 <[email protected]>
Acked-by: Rik van Riel <[email protected]>
Cc: stable <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Mel Gorman authored and torvalds committed Jan 30, 2014
1 parent a1c3bfb commit c297663
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions mm/mempolicy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2654,7 +2654,7 @@ void mpol_free_shared_policy(struct shared_policy *p)
}

#ifdef CONFIG_NUMA_BALANCING
static bool __initdata numabalancing_override;
static int __initdata numabalancing_override;

static void __init check_numabalancing_enable(void)
{
Expand All @@ -2663,9 +2663,15 @@ static void __init check_numabalancing_enable(void)
if (IS_ENABLED(CONFIG_NUMA_BALANCING_DEFAULT_ENABLED))
numabalancing_default = true;

/* Parsed by setup_numabalancing. override == 1 enables, -1 disables */
if (numabalancing_override)
set_numabalancing_state(numabalancing_override == 1);

if (nr_node_ids > 1 && !numabalancing_override) {
printk(KERN_INFO "Enabling automatic NUMA balancing. "
"Configure with numa_balancing= or the kernel.numa_balancing sysctl");
printk(KERN_INFO "%s automatic NUMA balancing. "
"Configure with numa_balancing= or the "
"kernel.numa_balancing sysctl",
numabalancing_default ? "Enabling" : "Disabling");
set_numabalancing_state(numabalancing_default);
}
}
Expand All @@ -2675,13 +2681,12 @@ static int __init setup_numabalancing(char *str)
int ret = 0;
if (!str)
goto out;
numabalancing_override = true;

if (!strcmp(str, "enable")) {
set_numabalancing_state(true);
numabalancing_override = 1;
ret = 1;
} else if (!strcmp(str, "disable")) {
set_numabalancing_state(false);
numabalancing_override = -1;
ret = 1;
}
out:
Expand Down

0 comments on commit c297663

Please sign in to comment.