@@ -36,6 +36,7 @@ typedef u8 nodeid_t;
extern bool numa_disabled(void);
extern void numa_set_distance(nodeid_t from, nodeid_t to,
unsigned int distance);
+extern void numa_detect_cpu_node(unsigned int cpu);
#else
@@ -73,6 +74,14 @@ static inline void numa_set_node(unsigned int cpu, nodeid_t node)
{
}
+static inline void numa_add_cpu(unsigned int cpu)
+{
+}
+
+static inline void numa_detect_cpu_node(unsigned int cpu)
+{
+}
+
#endif
#define arch_want_default_dmazone() (false)
@@ -81,6 +81,16 @@ void __init numa_set_distance(nodeid_t from, nodeid_t to,
node_distance_map[from][to] = distance;
}
+void numa_detect_cpu_node(unsigned int cpu)
+{
+ nodeid_t node = cpu_to_node[cpu];
+
+ if ( node == NUMA_NO_NODE )
+ node = 0;
+
+ node_set_online(node);
+}
+
unsigned char __node_distance(nodeid_t from, nodeid_t to)
{
/* When NUMA is off, any distance will be treated as remote. */
@@ -1205,6 +1205,11 @@ void __init start_xen(unsigned long boot_phys_offset,
for_each_present_cpu ( i )
{
+ /* Detect and online node based on cpu_to_node[]. */
+ numa_detect_cpu_node(i);
+ /* Set up node_to_cpumask based on cpu_to_node[]. */
+ numa_add_cpu(i);
+
if ( (num_online_cpus() < nr_cpu_ids) && !cpu_online(i) )
{
int ret = cpu_up(i);