mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
powerpc/numa: Use cpu node map of first sibling thread
All the sibling threads of a core have to be part of the same node. To ensure that all the sibling threads map to the same node, always lookup/update the cpu-to-node map of the first thread in the core. Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Reported-by: Abdul Haleem <abdhalee@linux.vnet.ibm.com> Reviewed-by: Nathan Lynch <nathanl@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20200129135301.24739-4-srikar@linux.vnet.ibm.com
This commit is contained in:
parent
76b7bfb173
commit
413e40550c
1 changed files with 20 additions and 2 deletions
|
@ -467,15 +467,20 @@ static int of_drconf_to_nid_single(struct drmem_lmb *lmb)
|
||||||
*/
|
*/
|
||||||
static int numa_setup_cpu(unsigned long lcpu)
|
static int numa_setup_cpu(unsigned long lcpu)
|
||||||
{
|
{
|
||||||
int nid = NUMA_NO_NODE;
|
|
||||||
struct device_node *cpu;
|
struct device_node *cpu;
|
||||||
|
int fcpu = cpu_first_thread_sibling(lcpu);
|
||||||
|
int nid = NUMA_NO_NODE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If a valid cpu-to-node mapping is already available, use it
|
* If a valid cpu-to-node mapping is already available, use it
|
||||||
* directly instead of querying the firmware, since it represents
|
* directly instead of querying the firmware, since it represents
|
||||||
* the most recent mapping notified to us by the platform (eg: VPHN).
|
* the most recent mapping notified to us by the platform (eg: VPHN).
|
||||||
|
* Since cpu_to_node binding remains the same for all threads in the
|
||||||
|
* core. If a valid cpu-to-node mapping is already available, for
|
||||||
|
* the first thread in the core, use it.
|
||||||
*/
|
*/
|
||||||
if ((nid = numa_cpu_lookup_table[lcpu]) >= 0) {
|
nid = numa_cpu_lookup_table[fcpu];
|
||||||
|
if (nid >= 0) {
|
||||||
map_cpu_to_node(lcpu, nid);
|
map_cpu_to_node(lcpu, nid);
|
||||||
return nid;
|
return nid;
|
||||||
}
|
}
|
||||||
|
@ -496,6 +501,19 @@ out_present:
|
||||||
if (nid < 0 || !node_possible(nid))
|
if (nid < 0 || !node_possible(nid))
|
||||||
nid = first_online_node;
|
nid = first_online_node;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Update for the first thread of the core. All threads of a core
|
||||||
|
* have to be part of the same node. This not only avoids querying
|
||||||
|
* for every other thread in the core, but always avoids a case
|
||||||
|
* where virtual node associativity change causes subsequent threads
|
||||||
|
* of a core to be associated with different nid. However if first
|
||||||
|
* thread is already online, expect it to have a valid mapping.
|
||||||
|
*/
|
||||||
|
if (fcpu != lcpu) {
|
||||||
|
WARN_ON(cpu_online(fcpu));
|
||||||
|
map_cpu_to_node(fcpu, nid);
|
||||||
|
}
|
||||||
|
|
||||||
map_cpu_to_node(lcpu, nid);
|
map_cpu_to_node(lcpu, nid);
|
||||||
of_node_put(cpu);
|
of_node_put(cpu);
|
||||||
out:
|
out:
|
||||||
|
|
Loading…
Add table
Reference in a new issue