[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>
This commit is contained in:
Dave Hansen 2005-06-23 00:07:41 -07:00 коммит произвёл Linus Torvalds
Родитель 348f8b6c48
Коммит 5b505b90b2
3 изменённых файлов: 17 добавлений и 1 удалений

Просмотреть файл

@ -216,6 +216,7 @@ static unsigned long calculate_numa_remap_pages(void)
{
int nid;
unsigned long size, reserve_pages = 0;
unsigned long pfn;
for_each_online_node(nid) {
/*
@ -234,6 +235,19 @@ static unsigned long calculate_numa_remap_pages(void)
size = (size + LARGE_PAGE_BYTES - 1) / LARGE_PAGE_BYTES;
/* now the roundup is correct, convert to PAGE_SIZE pages */
size = size * PTRS_PER_PTE;
/*
* Validate the region we are allocating only contains valid
* pages.
*/
for (pfn = node_end_pfn[nid] - size;
pfn < node_end_pfn[nid]; pfn++)
if (!page_is_ram(pfn))
break;
if (pfn != node_end_pfn[nid])
size = 0;
printk("Reserving %ld pages of KVA for lmem_map of node %d\n",
size, nid);
node_remap_size[nid] = size;

Просмотреть файл

@ -191,7 +191,7 @@ static inline int page_kills_ppro(unsigned long pagenr)
extern int is_available_memory(efi_memory_desc_t *);
static inline int page_is_ram(unsigned long pagenr)
int page_is_ram(unsigned long pagenr)
{
int i;
unsigned long addr, end;

Просмотреть файл

@ -120,6 +120,8 @@ static __inline__ int get_order(unsigned long size)
extern int sysctl_legacy_va_layout;
extern int page_is_ram(unsigned long pagenr);
#endif /* __ASSEMBLY__ */
#ifdef __ASSEMBLY__