]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - arch/powerpc/mm/numa.c
Merge tag 'powerpc-4.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[mirror_ubuntu-zesty-kernel.git] / arch / powerpc / mm / numa.c
index f8b1da77671270b78b4fbc0e4484adae8bf924ce..75b9cd6150cc80c98aa4dfec8ab633f126638f01 100644 (file)
@@ -581,30 +581,22 @@ static void verify_cpu_node_mapping(int cpu, int node)
        }
 }
 
-static int cpu_numa_callback(struct notifier_block *nfb, unsigned long action,
-                            void *hcpu)
+/* Must run before sched domains notifier. */
+static int ppc_numa_cpu_prepare(unsigned int cpu)
 {
-       unsigned long lcpu = (unsigned long)hcpu;
-       int ret = NOTIFY_DONE, nid;
+       int nid;
 
-       switch (action) {
-       case CPU_UP_PREPARE:
-       case CPU_UP_PREPARE_FROZEN:
-               nid = numa_setup_cpu(lcpu);
-               verify_cpu_node_mapping((int)lcpu, nid);
-               ret = NOTIFY_OK;
-               break;
+       nid = numa_setup_cpu(cpu);
+       verify_cpu_node_mapping(cpu, nid);
+       return 0;
+}
+
+static int ppc_numa_cpu_dead(unsigned int cpu)
+{
 #ifdef CONFIG_HOTPLUG_CPU
-       case CPU_DEAD:
-       case CPU_DEAD_FROZEN:
-       case CPU_UP_CANCELED:
-       case CPU_UP_CANCELED_FROZEN:
-               unmap_cpu_from_node(lcpu);
-               ret = NOTIFY_OK;
-               break;
+       unmap_cpu_from_node(cpu);
 #endif
-       }
-       return ret;
+       return 0;
 }
 
 /*
@@ -913,11 +905,6 @@ static void __init dump_numa_memory_topology(void)
        }
 }
 
-static struct notifier_block ppc64_numa_nb = {
-       .notifier_call = cpu_numa_callback,
-       .priority = 1 /* Must run before sched domains notifier. */
-};
-
 /* Initialize NODE_DATA for a node on the local memory */
 static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn)
 {
@@ -985,15 +972,18 @@ void __init initmem_init(void)
        setup_node_to_cpumask_map();
 
        reset_numa_cpu_lookup_table();
-       register_cpu_notifier(&ppc64_numa_nb);
+
        /*
         * We need the numa_cpu_lookup_table to be accurate for all CPUs,
         * even before we online them, so that we can use cpu_to_{node,mem}
         * early in boot, cf. smp_prepare_cpus().
+        * _nocalls() + manual invocation is used because cpuhp is not yet
+        * initialized for the boot CPU.
         */
-       for_each_present_cpu(cpu) {
-               numa_setup_cpu((unsigned long)cpu);
-       }
+       cpuhp_setup_state_nocalls(CPUHP_POWER_NUMA_PREPARE, "POWER_NUMA_PREPARE",
+                                 ppc_numa_cpu_prepare, ppc_numa_cpu_dead);
+       for_each_present_cpu(cpu)
+               numa_setup_cpu(cpu);
 }
 
 static int __init early_numa(char *p)