diff options
author | Yasunori Goto <y-goto@jp.fujitsu.com> | 2006-06-27 05:53:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-27 20:32:36 -0400 |
commit | 306d6cbe86e2e6603ac3162e1294d5c75cfdeca6 (patch) | |
tree | 66f4b807c47eca11c272c154670ed3f8f468e11f /include/linux | |
parent | 1e3590e2e4a38e8390fdac5bda23330bf2801838 (diff) |
[PATCH] pgdat allocation for new node add (generic alloc node_data)
For node hotplug, basically we have to allocate new pgdat. But, there are
several types of implementations of pgdat.
1. Allocate only pgdat.
This style allocate only pgdat area.
And its address is recorded in node_data[].
It is most popular style.
2. Static array of pgdat
In this case, all of pgdats are static array.
Some archs use this style.
3. Allocate not only pgdat, but also per node data.
To increase performance, each node has copy of some data as
a per node data. So, this area must be allocated too.
Ia64 is this style. Ia64 has the copies of node_data[] array
on each per node data to increase performance.
In this series of patches, treat (1) as generic arch.
generic archs can use generic function. (2) and (3) should have
its own if necessary.
This patch defines pgdat allocator.
Updating NODE_DATA() macro function is in other patch.
Signed-off-by: Yasonori Goto <y-goto@jp.fujitsu.com>
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Cc: "Brown, Len" <len.brown@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/memory_hotplug.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index 29c1472efad0..c6fd2c0323fc 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h | |||
@@ -73,6 +73,61 @@ static inline int memory_add_physaddr_to_nid(u64 start) | |||
73 | } | 73 | } |
74 | #endif | 74 | #endif |
75 | 75 | ||
76 | #ifdef CONFIG_HAVE_ARCH_NODEDATA_EXTENSION | ||
77 | /* | ||
78 | * For supporting node-hotadd, we have to allocate a new pgdat. | ||
79 | * | ||
80 | * If an arch has generic style NODE_DATA(), | ||
81 | * node_data[nid] = kzalloc() works well. But it depends on the architecture. | ||
82 | * | ||
83 | * In general, generic_alloc_nodedata() is used. | ||
84 | * Now, arch_free_nodedata() is just defined for error path of node_hot_add. | ||
85 | * | ||
86 | */ | ||
87 | static inline pg_data_t *arch_alloc_nodedata(int nid) | ||
88 | { | ||
89 | return NULL; | ||
90 | } | ||
91 | static inline void arch_free_nodedata(pg_data_t *pgdat) | ||
92 | { | ||
93 | } | ||
94 | |||
95 | #else /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */ | ||
96 | |||
97 | #define arch_alloc_nodedata(nid) generic_alloc_nodedata(nid) | ||
98 | #define arch_free_nodedata(pgdat) generic_free_nodedata(pgdat) | ||
99 | |||
100 | #ifdef CONFIG_NUMA | ||
101 | /* | ||
102 | * If ARCH_HAS_NODEDATA_EXTENSION=n, this func is used to allocate pgdat. | ||
103 | * XXX: kmalloc_node() can't work well to get new node's memory at this time. | ||
104 | * Because, pgdat for the new node is not allocated/initialized yet itself. | ||
105 | * To use new node's memory, more consideration will be necessary. | ||
106 | */ | ||
107 | #define generic_alloc_nodedata(nid) \ | ||
108 | ({ \ | ||
109 | kzalloc(sizeof(pg_data_t), GFP_KERNEL); \ | ||
110 | }) | ||
111 | /* | ||
112 | * This definition is just for error path in node hotadd. | ||
113 | * For node hotremove, we have to replace this. | ||
114 | */ | ||
115 | #define generic_free_nodedata(pgdat) kfree(pgdat) | ||
116 | |||
117 | #else /* !CONFIG_NUMA */ | ||
118 | |||
119 | /* never called */ | ||
120 | static inline pg_data_t *generic_alloc_nodedata(int nid) | ||
121 | { | ||
122 | BUG(); | ||
123 | return NULL; | ||
124 | } | ||
125 | static inline void generic_free_nodedata(pg_data_t *pgdat) | ||
126 | { | ||
127 | } | ||
128 | #endif /* CONFIG_NUMA */ | ||
129 | #endif /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */ | ||
130 | |||
76 | #else /* ! CONFIG_MEMORY_HOTPLUG */ | 131 | #else /* ! CONFIG_MEMORY_HOTPLUG */ |
77 | /* | 132 | /* |
78 | * Stub functions for when hotplug is off | 133 | * Stub functions for when hotplug is off |