* [RFC PATCH v1 3/4] thp: fix huge page zapping for special PMDs
@ 2019-12-11 9:29 Mircea CIRJALIU - MELIU
2019-12-11 15:54 ` Kirill A. Shutemov
0 siblings, 1 reply; 3+ messages in thread
From: Mircea CIRJALIU - MELIU @ 2019-12-11 9:29 UTC (permalink / raw)
To: linux-mm, linux-kernel, Jerome Glisse, Paolo Bonzini, aarcange
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@bitdefender.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);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RFC PATCH v1 3/4] thp: fix huge page zapping for special PMDs
2019-12-11 9:29 [RFC PATCH v1 3/4] thp: fix huge page zapping for special PMDs Mircea CIRJALIU - MELIU
@ 2019-12-11 15:54 ` Kirill A. Shutemov
2019-12-11 17:08 ` Mircea CIRJALIU - MELIU
0 siblings, 1 reply; 3+ messages in thread
From: Kirill A. Shutemov @ 2019-12-11 15:54 UTC (permalink / raw)
To: Mircea CIRJALIU - MELIU
Cc: linux-mm, linux-kernel, Jerome Glisse, Paolo Bonzini, aarcange
On Wed, Dec 11, 2019 at 09:29:20AM +0000, Mircea CIRJALIU - MELIU wrote:
> When calling zap_vma_ptes() on VM_PFNMAP VMAs involving huge mappings,
Do we have such VMAs?
--
Kirill A. Shutemov
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [RFC PATCH v1 3/4] thp: fix huge page zapping for special PMDs
2019-12-11 15:54 ` Kirill A. Shutemov
@ 2019-12-11 17:08 ` Mircea CIRJALIU - MELIU
0 siblings, 0 replies; 3+ messages in thread
From: Mircea CIRJALIU - MELIU @ 2019-12-11 17:08 UTC (permalink / raw)
To: Kirill A. Shutemov
Cc: linux-mm, linux-kernel, Jerome Glisse, Paolo Bonzini, aarcange
> On Wed, Dec 11, 2019 at 09:29:20AM +0000, Mircea CIRJALIU - MELIU wrote:
> > When calling zap_vma_ptes() on VM_PFNMAP VMAs involving huge
> mappings,
>
> Do we have such VMAs?
I have such VMAs in the remote mapping feature.
Any reason why these VMAs are dangerous?
>
> --
> Kirill A. Shutemov
>
> ________________________
> This email was scanned by Bitdefender
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-12-11 17:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-11 9:29 [RFC PATCH v1 3/4] thp: fix huge page zapping for special PMDs Mircea CIRJALIU - MELIU
2019-12-11 15:54 ` Kirill A. Shutemov
2019-12-11 17:08 ` Mircea CIRJALIU - MELIU
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).