The patch titled Subject: powerpc/numa: set numa_node for all possible cpus has been added to the -mm tree. Its filename is powerpc-numa-set-numa_node-for-all-possible-cpus.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/powerpc-numa-set-numa_node-for-all-possible-cpus.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/powerpc-numa-set-numa_node-for-all-possible-cpus.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Srikar Dronamraju <srikar@xxxxxxxxxxxxxxxxxx> Subject: powerpc/numa: set numa_node for all possible cpus Patch series "Offline memoryless cpuless node 0", v5. Linux kernel configured with CONFIG_NUMA on a system with multiple possible nodes, marks node 0 as online at boot. However in practice, there are systems which have node 0 as memoryless and cpuless. This can cause 1. numa_balancing to be enabled on systems with only one online node. 2. Existence of dummy (cpuless and memoryless) node which can confuse users/scripts looking at output of lscpu / numactl. This patchset wants to correct this anomaly. This should only affect systems that have CONFIG_MEMORYLESS_NODES. Currently there are only 2 architectures ia64 and powerpc that have this config. Note: Patch 3 in this patch series depends on patches 1 and 2. Without patches 1 and 2, patch 3 might crash powerpc. This patch (of 3): A Powerpc system with multiple possible nodes and with CONFIG_NUMA enabled always used to have a node 0, even if node 0 does not any cpus or memory attached to it. As per PAPR, node affinity of a cpu is only available once its present / online. For all cpus that are possible but not present, cpu_to_node() would point to node 0. To ensure a cpuless, memoryless dummy node is not online, powerpc need to make sure all possible but not present cpu_to_node are set to a proper node. Link: http://lkml.kernel.org/r/20200624092846.9194-1-srikar@xxxxxxxxxxxxxxxxxx Link: http://lkml.kernel.org/r/20200624092846.9194-2-srikar@xxxxxxxxxxxxxxxxxx Signed-off-by: Srikar Dronamraju <srikar@xxxxxxxxxxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxx> Cc: Mel Gorman <mgorman@xxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Cc: "Kirill A. Shutemov" <kirill@xxxxxxxxxxxxx> Cc: Christopher Lameter <cl@xxxxxxxxx> Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx> Cc: Gautham R Shenoy <ego@xxxxxxxxxxxxxxxxxx> Cc: Satheesh Rajendran <sathnaga@xxxxxxxxxxxxxxxxxx> Cc: David Hildenbrand <david@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- arch/powerpc/mm/numa.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) --- a/arch/powerpc/mm/numa.c~powerpc-numa-set-numa_node-for-all-possible-cpus +++ a/arch/powerpc/mm/numa.c @@ -506,6 +506,11 @@ static int numa_setup_cpu(unsigned long int fcpu = cpu_first_thread_sibling(lcpu); int nid = NUMA_NO_NODE; + if (!cpu_present(lcpu)) { + set_cpu_numa_node(lcpu, first_online_node); + return first_online_node; + } + /* * If a valid cpu-to-node mapping is already available, use it * directly instead of querying the firmware, since it represents @@ -931,8 +936,17 @@ void __init mem_topology_setup(void) reset_numa_cpu_lookup_table(); - for_each_present_cpu(cpu) + for_each_possible_cpu(cpu) { + /* + * Powerpc with CONFIG_NUMA always used to have a node 0, + * even if it was memoryless or cpuless. For all cpus that + * are possible but not present, cpu_to_node() would point + * to node 0. To remove a cpuless, memoryless dummy node, + * powerpc need to make sure all possible but not present + * cpu_to_node are set to a proper node. + */ numa_setup_cpu(cpu); + } } void __init initmem_init(void) _ Patches currently in -mm which might be from srikar@xxxxxxxxxxxxxxxxxx are powerpc-numa-set-numa_node-for-all-possible-cpus.patch powerpc-numa-prefer-node-id-queried-from-vphn.patch mm-page_alloc-keep-memoryless-cpuless-node-0-offline.patch