Message ID | 1578579963-6075-2-git-send-email-lixinhai.lxh@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | mm/page_vma_mapped.c: Exactly compare hugetlbfs page's pfn in pfn_in_hpage() | expand |
On 2020-01-09 at 22:26 Li Xinhai wrote: >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 > sorry this been sent twice, please ignore this mail.
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);
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(+)