Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 645a7919 authored by Tejun Heo's avatar Tejun Heo Committed by Ingo Molnar
Browse files

x86: Unify CPU -> NUMA node mapping between 32 and 64bit



Unlike 64bit, 32bit has been using its own cpu_to_node_map[] for
CPU -> NUMA node mapping.  Replace it with early_percpu variable
x86_cpu_to_node_map and share the mapping code with 64bit.

* USE_PERCPU_NUMA_NODE_ID is now enabled for 32bit too.

* x86_cpu_to_node_map and numa_set/clear_node() are moved from
  numa_64 to numa.  For now, on 32bit, x86_cpu_to_node_map is initialized
  with 0 instead of NUMA_NO_NODE.  This is to avoid introducing unexpected
  behavior change and will be updated once init path is unified.

* srat_detect_node() is now enabled for x86_32 too.  It calls
  numa_set_node() and initializes the mapping making explicit
  cpu_to_node_map[] updates from map/unmap_cpu_to_node() unnecessary.

Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Cc: eric.dumazet@gmail.com
Cc: yinghai@kernel.org
Cc: brgerst@gmail.com
Cc: gorcunov@gmail.com
Cc: penberg@kernel.org
Cc: shaohui.zheng@intel.com
Cc: rientjes@google.com
LKML-Reference: <1295789862-25482-15-git-send-email-tj@kernel.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Cc: David Rientjes <rientjes@google.com>
parent bbc9e2f4
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1705,7 +1705,7 @@ config HAVE_ARCH_EARLY_PFN_TO_NID
	depends on NUMA
	depends on NUMA


config USE_PERCPU_NUMA_NODE_ID
config USE_PERCPU_NUMA_NODE_ID
	def_bool X86_64
	def_bool y
	depends on NUMA
	depends on NUMA


menu "Power management and ACPI options"
menu "Power management and ACPI options"
+8 −0
Original line number Original line Diff line number Diff line
@@ -30,4 +30,12 @@ static inline void set_apicid_to_node(int apicid, s16 node)
# include "numa_64.h"
# include "numa_64.h"
#endif
#endif


#ifdef CONFIG_NUMA
extern void __cpuinit numa_set_node(int cpu, int node);
extern void __cpuinit numa_clear_node(int cpu);
#else	/* CONFIG_NUMA */
static inline void numa_set_node(int cpu, int node)	{ }
static inline void numa_clear_node(int cpu)		{ }
#endif	/* CONFIG_NUMA */

#endif	/* _ASM_X86_NUMA_H */
#endif	/* _ASM_X86_NUMA_H */
+0 −4
Original line number Original line Diff line number Diff line
@@ -30,8 +30,6 @@ extern void setup_node_bootmem(int nodeid, unsigned long start,


extern void __init init_cpu_to_node(void);
extern void __init init_cpu_to_node(void);
extern int __cpuinit numa_cpu_node(int cpu);
extern int __cpuinit numa_cpu_node(int cpu);
extern void __cpuinit numa_set_node(int cpu, int node);
extern void __cpuinit numa_clear_node(int cpu);
extern void __cpuinit numa_add_cpu(int cpu);
extern void __cpuinit numa_add_cpu(int cpu);
extern void __cpuinit numa_remove_cpu(int cpu);
extern void __cpuinit numa_remove_cpu(int cpu);


@@ -43,8 +41,6 @@ void numa_emu_cmdline(char *);
#else
#else
static inline void init_cpu_to_node(void)		{ }
static inline void init_cpu_to_node(void)		{ }
static inline int numa_cpu_node(int cpu)		{ return NUMA_NO_NODE; }
static inline int numa_cpu_node(int cpu)		{ return NUMA_NO_NODE; }
static inline void numa_set_node(int cpu, int node)	{ }
static inline void numa_clear_node(int cpu)		{ }
static inline void numa_add_cpu(int cpu, int node)	{ }
static inline void numa_add_cpu(int cpu, int node)	{ }
static inline void numa_remove_cpu(int cpu)		{ }
static inline void numa_remove_cpu(int cpu)		{ }
#endif
#endif
+0 −17
Original line number Original line Diff line number Diff line
@@ -47,21 +47,6 @@


#include <asm/mpspec.h>
#include <asm/mpspec.h>


#ifdef CONFIG_X86_32

/* Mappings between logical cpu number and node number */
extern int cpu_to_node_map[];

/* Returns the number of the node containing CPU 'cpu' */
static inline int __cpu_to_node(int cpu)
{
	return cpu_to_node_map[cpu];
}
#define early_cpu_to_node __cpu_to_node
#define cpu_to_node __cpu_to_node

#else /* CONFIG_X86_64 */

/* Mappings between logical cpu number and node number */
/* Mappings between logical cpu number and node number */
DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map);
DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map);


@@ -84,8 +69,6 @@ static inline int early_cpu_to_node(int cpu)


#endif /* !CONFIG_DEBUG_PER_CPU_MAPS */
#endif /* !CONFIG_DEBUG_PER_CPU_MAPS */


#endif /* CONFIG_X86_64 */

/* Mappings between node number and cpus on that node. */
/* Mappings between node number and cpus on that node. */
extern cpumask_var_t node_to_cpumask_map[MAX_NUMNODES];
extern cpumask_var_t node_to_cpumask_map[MAX_NUMNODES];


+0 −5
Original line number Original line Diff line number Diff line
@@ -590,12 +590,7 @@ static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
	if (nid == -1 || !node_online(nid))
	if (nid == -1 || !node_online(nid))
		return;
		return;
	set_apicid_to_node(physid, nid);
	set_apicid_to_node(physid, nid);
#ifdef CONFIG_X86_64
	numa_set_node(cpu, nid);
	numa_set_node(cpu, nid);
#else /* CONFIG_X86_32 */
	cpu_to_node_map[cpu] = nid;
#endif

#endif
#endif
}
}


Loading