resubmit - [PATCH 4/4] 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 brining online is actually made up of valid ranges of ram.
Written-by Andy Whitcroft <[email protected]>
Signed-off-by Dave Hansen <[email protected]>
---
memhotplug-dave/arch/i386/mm/discontig.c | 14 ++++++++++++++ memhotplug-dave/arch/i386/mm/init.c | 2 +- memhotplug-dave/include/asm-i386/page.h | 2 ++ 3 files changed, 17 insertions(+), 1 deletion(-)
arch/i386/mm/discontig.c renamed from arch/i386/mm/discontig.c~FROM-MM-validate-remap-pages +14 -0
@@ -185,6 +185,7 @@ static unsigned long calculate_numa_rema {int nid;unsigned long size, reserve_pages =0 ; +unsigned long pfn;for_each_online_node (nid) {if (nid ==0 )
@@ -208,6 +209,19 @@ static unsigned long calculate_numa_rema 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;
arch/i386/mm/init.c renamed from arch/i386/mm/init.c~FROM-MM-validate-remap-pages +1 -1
@@ -191,7 +191,7 @@ static inline int page_kills_ppro(unsignextern 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;
include/asm-i386/page.h renamed from include/asm-i386/page.h~FROM-MM-validate-remap-pages +2 -0
@@ -119,6 +119,8 @@ static __inline__ int get_order(unsignedextern int sysctl_legacy_va_layout; +extern int page_is_ram (unsigned long pagenr); +#endif /* __ASSEMBLY__ */ #ifdef __ASSEMBLY__
_
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>