linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Li Xinhai <lixinhai.lxh@gmail.com>
To: linux-mm@kvack.org
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: [PATCH] mm/page_vma_mapped.c: Exactly compare hugetlbfs page's pfn in pfn_in_hpage()
Date: Thu,  9 Jan 2020 14:26:03 +0000	[thread overview]
Message-ID: <1578579963-6075-2-git-send-email-lixinhai.lxh@gmail.com> (raw)
In-Reply-To: <1578579963-6075-1-git-send-email-lixinhai.lxh@gmail.com>

check_pte is called for hugetlbfs page and comparing pfn in pfn_in_page,
where pfn is compared in range [hpage_pfn, hpage_pfn+HPAGE_PMD_NR). Now
change it to match exactly for hugetlbfs page to avoid hiding any
potential problems.

Signed-off-by: Li Xinhai <lixinhai.lxh@gmail.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
---
 mm/page_vma_mapped.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/page_vma_mapped.c b/mm/page_vma_mapped.c
index eff4b45..434978b 100644
--- a/mm/page_vma_mapped.c
+++ b/mm/page_vma_mapped.c
@@ -55,6 +55,8 @@ static bool map_pte(struct page_vma_mapped_walk *pvmw)
 static inline bool pfn_in_hpage(struct page *hpage, unsigned long pfn)
 {
 	unsigned long hpage_pfn = page_to_pfn(hpage);
+	if (unlikely(PageHuge(hpage)))
+		return pfn == hpage_pfn;
 
 	/* THP can be referenced by any subpage */
 	return pfn >= hpage_pfn && pfn - hpage_pfn < hpage_nr_pages(hpage);
-- 
1.8.3.1



  reply	other threads:[~2020-01-09 14:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-09 14:26 [PATCH v2] mm/page_vma_mapped.c: Detect mismatched pfn of hugetlbfs page " Li Xinhai
2020-01-09 14:26 ` Li Xinhai [this message]
2020-01-09 14:31   ` [PATCH] mm/page_vma_mapped.c: Exactly compare hugetlbfs page's pfn " Li Xinhai
2020-01-09 15:00 ` [PATCH v2] mm/page_vma_mapped.c: Detect mismatched pfn of hugetlbfs page " Michal Hocko
2020-01-09 17:09   ` Mike Kravetz
2020-01-09 22:48     ` Li Xinhai
2020-01-09 23:00       ` Mike Kravetz
2020-01-10  2:52         ` Li Xinhai
2020-01-10  6:22           ` Michal Hocko
2020-01-10  7:11             ` Li Xinhai
  -- strict thread matches above, loose matches on Subject: below --
2020-01-09  6:44 [PATCH] mm/page_vma_mapped.c: Exactly compare hugetlbfs page's pfn " Li Xinhai
2020-01-09 12:30 ` Kirill A. Shutemov
2020-01-09 13:55   ` Li Xinhai

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=1578579963-6075-2-git-send-email-lixinhai.lxh@gmail.com \
    --to=lixinhai.lxh@gmail.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-mm@kvack.org \
    /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