[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <DB7PR02MB3979BC324920A783BD5BB721BB5A0@DB7PR02MB3979.eurprd02.prod.outlook.com>
Date: Wed, 11 Dec 2019 09:29:20 +0000
From: Mircea CIRJALIU - MELIU <mcirjaliu@...defender.com>
To: "linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Jerome Glisse <jglisse@...hat.com>,
Paolo Bonzini <pbonzini@...hat.com>,
"aarcange@...hat.com" <aarcange@...hat.com>
Subject: [RFC PATCH v1 3/4] thp: fix huge page zapping for special PMDs
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@...defender.com>
---
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);
Powered by blists - more mailing lists