]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/page_vma_mapped.c: check possible huge PMD map with transhuge_vma_suitable()
authorYang Shi <shy828301@gmail.com>
Fri, 13 May 2022 19:17:05 +0000 (12:17 -0700)
committerakpm <akpm@linux-foundation.org>
Sun, 26 Jun 2022 22:40:30 +0000 (15:40 -0700)
commit4ba09594e6b34e60d17349d791e99dbd82088de6
tree3adbcd2e1444d98f839e9abb2e18925b0d8ed942
parentcfe16743c4f4b86c6dd84632d3aba25478aee77d
mm/page_vma_mapped.c: check possible huge PMD map with transhuge_vma_suitable()

IIUC page_vma_mapped_walk() checks if the vma is possibly huge PMD mapped
with transparent_hugepage_active() and "pvmw->nr_pages >= HPAGE_PMD_NR".

Actually pvmw->nr_pages is returned by compound_nr() or folio_nr_pages(),
so the page should be THP as long as "pvmw->nr_pages >= HPAGE_PMD_NR".
And it is guaranteed THP is allocated for valid VMA in the first place.
But it may be not PMD mapped if the VMA is file VMA and it is not properly
aligned.  The transhuge_vma_suitable() is used to do such check, so
replace transparent_hugepage_active() to it, which is too heavy and
overkilling.

Link: https://lkml.kernel.org/r/20220513191705.457775-1-shy828301@gmail.com
Signed-off-by: Yang Shi <shy828301@gmail.com>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/huge_mm.h
mm/page_vma_mapped.c