From: Mircea CIRJALIU - MELIU <mcirjaliu@bitdefender.com>
To: "linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Jerome Glisse <jglisse@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
"aarcange@redhat.com" <aarcange@redhat.com>
Subject: [RFC PATCH v1 3/4] thp: fix huge page zapping for special PMDs
Date: Wed, 11 Dec 2019 09:29:20 +0000 [thread overview]
Message-ID: <DB7PR02MB3979BC324920A783BD5BB721BB5A0@DB7PR02MB3979.eurprd02.prod.outlook.com> (raw)
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);
next reply other threads:[~2019-12-11 9:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-11 9:29 Mircea CIRJALIU - MELIU [this message]
2019-12-11 15:54 ` Kirill A. Shutemov
2019-12-11 17:08 ` Mircea CIRJALIU - MELIU
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DB7PR02MB3979BC324920A783BD5BB721BB5A0@DB7PR02MB3979.eurprd02.prod.outlook.com \
--to=mcirjaliu@bitdefender.com \
--cc=aarcange@redhat.com \
--cc=jglisse@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pbonzini@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox