The patch titled Subject: mm: khugepaged: better comments for anon vma check in hugepage_vma_revalidate has been added to the -mm mm-unstable branch. Its filename is mm-khugepaged-better-comments-for-anon-vma-check-in-hugepage_vma_revalidate.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-khugepaged-better-comments-for-anon-vma-check-in-hugepage_vma_revalidate.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Yang Shi <shy828301@xxxxxxxxx> Subject: mm: khugepaged: better comments for anon vma check in hugepage_vma_revalidate Date: Wed, 15 Jun 2022 10:29:22 -0700 The hugepage_vma_revalidate() needs to check if the vma is still anonymous vma or not since the address may be unmapped then remapped to file before khugepaged reaquired the mmap_lock. The old comment is not quite helpful, elaborate this with better comment. Link: https://lkml.kernel.org/r/20220615172926.546974-4-shy828301@xxxxxxxxx Signed-off-by: Yang Shi <shy828301@xxxxxxxxx> Cc: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Cc: Miaohe Lin <linmiaohe@xxxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Cc: Zach O'Keefe <zokeefe@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/khugepaged.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/mm/khugepaged.c~mm-khugepaged-better-comments-for-anon-vma-check-in-hugepage_vma_revalidate +++ a/mm/khugepaged.c @@ -954,7 +954,13 @@ static int hugepage_vma_revalidate(struc return SCAN_ADDRESS_RANGE; if (!hugepage_vma_check(vma, vma->vm_flags)) return SCAN_VMA_CHECK; - /* Anon VMA expected */ + /* + * Anon VMA expected, the address may be unmapped then + * remapped to file after khugepaged reaquired the mmap_lock. + * + * hugepage_vma_check may return true for qualified file + * vmas. + */ if (!vma->anon_vma || !vma_is_anonymous(vma)) return SCAN_VMA_CHECK; return 0; _ Patches currently in -mm which might be from shy828301@xxxxxxxxx are mm-rmap-use-the-correct-parameter-name-for-define_page_vma_walk.patch mm-pvmw-check-possible-huge-pmd-map-by-transhuge_vma_suitable.patch mm-khugepaged-check-thp-flag-in-hugepage_vma_check.patch mm-thp-consolidate-vma-size-check-to-transhuge_vma_suitable.patch mm-khugepaged-better-comments-for-anon-vma-check-in-hugepage_vma_revalidate.patch mm-thp-kill-transparent_hugepage_active.patch mm-thp-kill-__transhuge_page_enabled.patch mm-khugepaged-reorg-some-khugepaged-helpers.patch doc-proc-fix-the-description-to-thpeligible.patch