From: Ravikiran G Thirumalai Date: Fri, 29 Jul 2005 21:03:28 +0000 (-0700) Subject: [PATCH] mm: Ensure proper alignment for node_remap_start_pfn X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=94d2ac66c12397e2ca7988dbf59f24a966d275cb;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [PATCH] mm: Ensure proper alignment for node_remap_start_pfn While reserving KVA for lmem_maps of node, we have to make sure that node_remap_start_pfn[] is aligned to a proper pmd boundary. (node_remap_start_pfn[] gets its value from node_end_pfn[]) Signed-off-by: Ravikiran Thirumalai Signed-off-by: Shai Fultheim Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/arch/i386/mm/discontig.c b/arch/i386/mm/discontig.c index b358f0702a44..c369a8bf7cbe 100644 --- a/arch/i386/mm/discontig.c +++ b/arch/i386/mm/discontig.c @@ -243,6 +243,14 @@ static unsigned long calculate_numa_remap_pages(void) /* now the roundup is correct, convert to PAGE_SIZE pages */ size = size * PTRS_PER_PTE; + if (node_end_pfn[nid] & (PTRS_PER_PTE-1)) { + /* + * Adjust size if node_end_pfn is not on a proper + * pmd boundary. remap_numa_kva will barf otherwise. + */ + size += node_end_pfn[nid] & (PTRS_PER_PTE-1); + } + /* * Validate the region we are allocating only contains valid * pages.