]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
s390/numa: pin all possible cpus to nodes early
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Fri, 2 Dec 2016 10:12:01 +0000 (11:12 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 7 Dec 2016 06:23:33 +0000 (07:23 +0100)
It is required to have an early static cpu to node mapping. This patch
pins all possible cpus to nodes for which no topology information is
present. Since there is no interface available which would allow to
tell where a non-present cpu would appear topology-wise, simply use a
round robin algorithm.
Right now this makes sure that the cpu_to_node() function will return
the same value for a cpu during the life time of the system.

Acked-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/numa/mode_emu.c

index 02b840d8f9afa0c685b061c0182794375bd33c2f..cfd08384f0abfe287c5a5fcf9762e638a7decb19 100644 (file)
@@ -424,6 +424,27 @@ static void print_node_to_core_map(void)
        }
 }
 
+static void pin_all_possible_cpus(void)
+{
+       int core_id, node_id, cpu;
+       static int initialized;
+
+       if (initialized)
+               return;
+       print_node_to_core_map();
+       node_id = 0;
+       for_each_possible_cpu(cpu) {
+               core_id = smp_get_base_cpu(cpu);
+               if (emu_cores->to_node_id[core_id] != NODE_ID_FREE)
+                       continue;
+               pin_core_to_node(core_id, node_id);
+               cpu_topology[cpu].node_id = node_id;
+               node_id = (node_id + 1) % emu_nodes;
+       }
+       print_node_to_core_map();
+       initialized = 1;
+}
+
 /*
  * Transfer physical topology into a NUMA topology and modify CPU masks
  * according to the NUMA topology.
@@ -441,7 +462,7 @@ static void emu_update_cpu_topology(void)
        toptree_free(phys);
        toptree_to_topology(numa);
        toptree_free(numa);
-       print_node_to_core_map();
+       pin_all_possible_cpus();
 }
 
 /*