lkml.org 
[lkml]   [2019]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 5/6] x86/numa: push forward the setup of node to cpumask map
Date
At present the node to cpumask map is set up until the secondary
cpu boot up. But it is too late for the purpose of building node fall back
list at early boot stage. Considering that init_cpu_to_node() already owns
cpu to node map, it is a good place to set up node to cpumask map too. So
do it by calling numa_add_cpu(cpu) in init_cpu_to_node().

Signed-off-by: Pingfan Liu <kernelfans@gmail.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Ingo Molnar <mingo@redhat.com>
CC: Borislav Petkov <bp@alien8.de>
CC: "H. Peter Anvin" <hpa@zytor.com>
CC: Dave Hansen <dave.hansen@linux.intel.com>
CC: Vlastimil Babka <vbabka@suse.cz>
CC: Mike Rapoport <rppt@linux.vnet.ibm.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Mel Gorman <mgorman@suse.de>
CC: Joonsoo Kim <iamjoonsoo.kim@lge.com>
CC: Andy Lutomirski <luto@kernel.org>
CC: Andi Kleen <ak@linux.intel.com>
CC: Petr Tesarik <ptesarik@suse.cz>
CC: Michal Hocko <mhocko@suse.com>
CC: Stephen Rothwell <sfr@canb.auug.org.au>
CC: Jonathan Corbet <corbet@lwn.net>
CC: Nicholas Piggin <npiggin@gmail.com>
CC: Daniel Vacek <neelx@redhat.com>
CC: linux-kernel@vger.kernel.org
---
arch/x86/include/asm/topology.h | 4 ----
arch/x86/kernel/setup_percpu.c | 3 ---
arch/x86/mm/numa.c | 5 ++++-
3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index 453cf38..fad77c7 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -73,8 +73,6 @@ static inline const struct cpumask *cpumask_of_node(int node)
}
#endif

-extern void setup_node_to_cpumask_map(void);
-
#define pcibus_to_node(bus) __pcibus_to_node(bus)

extern int __node_distance(int, int);
@@ -96,8 +94,6 @@ static inline int early_cpu_to_node(int cpu)
return 0;
}

-static inline void setup_node_to_cpumask_map(void) { }
-
#endif

#include <asm-generic/topology.h>
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index e8796fc..206fa43 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -283,9 +283,6 @@ void __init setup_per_cpu_areas(void)
early_per_cpu_ptr(x86_cpu_to_node_map) = NULL;
#endif

- /* Setup node to cpumask map */
- setup_node_to_cpumask_map();
-
/* Setup cpu initialized, callin, callout masks */
setup_cpu_local_masks();

diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index c8dd7af..8d73e2273 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -110,7 +110,7 @@ void numa_clear_node(int cpu)
* Note: cpumask_of_node() is not valid until after this is done.
* (Use CONFIG_DEBUG_PER_CPU_MAPS to check this.)
*/
-void __init setup_node_to_cpumask_map(void)
+static void __init setup_node_to_cpumask_map(void)
{
unsigned int node;

@@ -738,6 +738,7 @@ void __init init_cpu_to_node(void)
BUG_ON(cpu_to_apicid == NULL);
rr = first_node(node_online_map);

+ setup_node_to_cpumask_map();
for_each_possible_cpu(cpu) {
int node = numa_cpu_node(cpu);

@@ -750,6 +751,7 @@ void __init init_cpu_to_node(void)
*/
if (node == NUMA_NO_NODE) {
numa_set_node(cpu, rr);
+ numa_add_cpu(cpu);
rr = next_node_in(rr, node_online_map);
continue;
}
@@ -758,6 +760,7 @@ void __init init_cpu_to_node(void)
init_memory_less_node(node);

numa_set_node(cpu, node);
+ numa_add_cpu(cpu);
}
}

--
2.7.4
\
 
 \ /
  Last update: 2019-02-24 13:36    [W:0.171 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site