diff options
author | Dave Hansen <haveblue@us.ibm.com> | 2005-06-23 03:07:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-23 12:45:01 -0400 |
commit | 5b505b90b2d54e526cc8d123bdef3b98c9f0bbc6 (patch) | |
tree | c56ce2547e654eb0a2166171ba8ca19eaa8cd65f /arch/i386/mm/discontig.c | |
parent | 348f8b6c4837a07304d2f72b11ce8d96588065e0 (diff) |
[PATCH] sparsemem base: teach discontig about sparse ranges
discontig.c has some assumptions that mem_map[]s inside of a node are
contiguous. Teach it to make sure that each region that it's bringing online
is actually made up of valid ranges of ram.
Written-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/i386/mm/discontig.c')
-rw-r--r-- | arch/i386/mm/discontig.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/i386/mm/discontig.c b/arch/i386/mm/discontig.c index dcc71f969b01..088ca4722183 100644 --- a/arch/i386/mm/discontig.c +++ b/arch/i386/mm/discontig.c | |||
@@ -216,6 +216,7 @@ static unsigned long calculate_numa_remap_pages(void) | |||
216 | { | 216 | { |
217 | int nid; | 217 | int nid; |
218 | unsigned long size, reserve_pages = 0; | 218 | unsigned long size, reserve_pages = 0; |
219 | unsigned long pfn; | ||
219 | 220 | ||
220 | for_each_online_node(nid) { | 221 | for_each_online_node(nid) { |
221 | /* | 222 | /* |
@@ -234,6 +235,19 @@ static unsigned long calculate_numa_remap_pages(void) | |||
234 | size = (size + LARGE_PAGE_BYTES - 1) / LARGE_PAGE_BYTES; | 235 | size = (size + LARGE_PAGE_BYTES - 1) / LARGE_PAGE_BYTES; |
235 | /* now the roundup is correct, convert to PAGE_SIZE pages */ | 236 | /* now the roundup is correct, convert to PAGE_SIZE pages */ |
236 | size = size * PTRS_PER_PTE; | 237 | size = size * PTRS_PER_PTE; |
238 | |||
239 | /* | ||
240 | * Validate the region we are allocating only contains valid | ||
241 | * pages. | ||
242 | */ | ||
243 | for (pfn = node_end_pfn[nid] - size; | ||
244 | pfn < node_end_pfn[nid]; pfn++) | ||
245 | if (!page_is_ram(pfn)) | ||
246 | break; | ||
247 | |||
248 | if (pfn != node_end_pfn[nid]) | ||
249 | size = 0; | ||
250 | |||
237 | printk("Reserving %ld pages of KVA for lmem_map of node %d\n", | 251 | printk("Reserving %ld pages of KVA for lmem_map of node %d\n", |
238 | size, nid); | 252 | size, nid); |
239 | node_remap_size[nid] = size; | 253 | node_remap_size[nid] = size; |