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). For hugetlbfs page, pfn must equal to hpage_pfn, so catch it as bug if they are not equal. Signed-off-by: Li Xinhai <lixinhai.lxh@xxxxxxxxx> Cc: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> --- mm/page_vma_mapped.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/page_vma_mapped.c b/mm/page_vma_mapped.c index eff4b45..713aaed 100644 --- a/mm/page_vma_mapped.c +++ b/mm/page_vma_mapped.c @@ -55,6 +55,7 @@ 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); + VM_BUG_ON_PAGE(PageHuge(hpage) && pfn != hpage_pfn, hpage); /* THP can be referenced by any subpage */ return pfn >= hpage_pfn && pfn - hpage_pfn < hpage_nr_pages(hpage); -- 1.8.3.1