[RFC PATCH v1 3/4] thp: fix huge page zapping for special PMDs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When calling zap_vma_ptes() on VM_PFNMAP VMAs involving huge mappings,
pmd_page() will return an invalid page, causing trouble. Use instead
vm_normal_page_pmd() and test for returned page like zap_pte_range().

Signed-off-by: Mircea Cirjaliu <mcirjaliu@xxxxxxxxxxxxxxx>
---
 mm/huge_memory.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 41a0fbd..92ce487 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1804,7 +1804,11 @@ int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,
 		int flush_needed = 1;
 
 		if (pmd_present(orig_pmd)) {
-			page = pmd_page(orig_pmd);
+			page = vm_normal_page_pmd(vma, addr, orig_pmd);
+			if (unlikely(!page)) {
+				spin_unlock(ptl);
+				return 1;
+			}
 			page_remove_rmap(page, true);
 			VM_BUG_ON_PAGE(page_mapcount(page) < 0, page);
 			VM_BUG_ON_PAGE(!PageHead(page), page);





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux