Thread (7 messages) flat view 7 messages, 3 authors, 2017-06-07

Re: [PATCH] powerpc/numa: Fix percpu allocations to be NUMA aware

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2017-06-07 11:28:02

Balbir Singh [off-list ref] writes:
On Fri, Jun 2, 2017 at 3:14 PM, Michael Ellerman [off-list ref] wrote:
quoted
diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
index 8b3b46b7b0f2..8f3b2ec09b9e 100644
--- a/arch/powerpc/include/asm/topology.h
+++ b/arch/powerpc/include/asm/topology.h
@@ -44,8 +44,22 @@ extern void __init dump_numa_cpu_topology(void);
 extern int sysfs_add_device_to_node(struct device *dev, int nid);
 extern void sysfs_remove_device_from_node(struct device *dev, int nid);

+static inline int early_cpu_to_node(int cpu)
+{
+       int nid;
+
+       nid = numa_cpu_lookup_table[cpu];
+
+       /*
+        * Some functions, eg. node_distance() don't cope with -1, so instead
+        * fall back to node 0 if nid is unset (it should be, except bugs).
+        */
+       return (nid < 0) ? 0 : nid;
+}
 #else
Not sure if its entirely related, but I had tried to do

https://patchwork.ozlabs.org/patch/683556/

to setup the mapping earlier, but we would have still missed the pcpu_fc_alloc.
It's related. But doesn't fix this bug.

I didn't merge it because I assumed it wouldn't build with
CONFIG_NUMA=n, but seems it does so I'll grab it.

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help