[PATCH 1/4] make dev_to_node return online node

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Yinghai Lu
Date: Wednesday, February 20, 2008 - 1:32 am

some numa system ( with multi HT chains) may return node without ram. aka it
is not online.
try to get one online node.

Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>

diff --git a/include/linux/device.h b/include/linux/device.h
index 2258d89..7f1a4d7 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -478,7 +478,12 @@ struct device {
 #ifdef CONFIG_NUMA
 static inline int dev_to_node(struct device *dev)
 {
-	return dev->numa_node;
+	int node;
+	node = dev->numa_node;
+
+	if (node != -1 && !node_online(node))
+		node = numa_node_id();
+	return node;
 }
 static inline void set_dev_node(struct device *dev, int node)
 {
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 1/4] make dev_to_node return online node, Yinghai Lu, (Wed Feb 20, 1:32 am)
[PATCH 2/4] x86_64: fix dma_alloc_pages v2, Yinghai Lu, (Wed Feb 20, 1:36 am)
Re: [PATCH 2/4] x86_64: fix dma_alloc_pages v2, Yinghai Lu, (Wed Feb 20, 3:07 am)
Re: [PATCH 1/4] make dev_to_node return online node, Yinghai Lu, (Wed Feb 20, 1:41 pm)