[PATCH] powerpc/numa: Fix percpu allocations to be NUMA aware
Michael Ellerman
mpe at ellerman.id.au
Wed Jun 7 21:28:01 AEST 2017
Balbir Singh <bsingharora at gmail.com> writes:
> On Fri, Jun 2, 2017 at 3:14 PM, Michael Ellerman <mpe at ellerman.id.au> wrote:
>> 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
More information about the Linuxppc-dev
mailing list