The patch titled Subject: mm: khugepaged: check THP flag in hugepage_vma_check() has been added to the -mm mm-unstable branch. Its filename is mm-khugepaged-check-thp-flag-in-hugepage_vma_check.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-khugepaged-check-thp-flag-in-hugepage_vma_check.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: check THP flag in hugepage_vma_check() Date: Thu, 16 Jun 2022 10:48:34 -0700 Patch series "Cleanup transhuge_xxx helpers", v5. This series is the follow-up of the discussion about cleaning up transhuge_xxx helpers at https://lore.kernel.org/linux-mm/627a71f8-e879-69a5-ceb3-fc8d29d2f7f1@xxxxxxx/. THP has a bunch of helpers that do VMA sanity check for different paths, they do the similar checks for the most callsites and have a lot duplicate codes. And it is confusing what helpers should be used at what conditions. This series reorganized and cleaned up the code so that we could consolidate all the checks into hugepage_vma_check(). The transhuge_vma_enabled(), transparent_hugepage_active() and __transparent_hugepage_enabled() are killed by this series. This patch (of 7): Currently the THP flag check in hugepage_vma_check() will fallthrough if the flag is NEVER and VM_HUGEPAGE is set. This is not a problem for now since all the callers have the flag checked before or can't be invoked if the flag is NEVER. However, the following patch will call hugepage_vma_check() in more places, for example, page fault, so this flag must be checked in hugepge_vma_check(). Link: https://lkml.kernel.org/r/20220616174840.1202070-1-shy828301@xxxxxxxxx Link: https://lkml.kernel.org/r/20220616174840.1202070-2-shy828301@xxxxxxxxx Signed-off-by: Yang Shi <shy828301@xxxxxxxxx> Reviewed-by: Zach O'Keefe <zokeefe@xxxxxxxxxx> Reviewed-by: Miaohe Lin <linmiaohe@xxxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Cc: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Cc: Miaohe Lin <linmiaohe@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/khugepaged.c | 3 +++ 1 file changed, 3 insertions(+) --- a/mm/khugepaged.c~mm-khugepaged-check-thp-flag-in-hugepage_vma_check +++ a/mm/khugepaged.c @@ -451,6 +451,9 @@ bool hugepage_vma_check(struct vm_area_s if (shmem_file(vma->vm_file)) return shmem_huge_enabled(vma); + if (!khugepaged_enabled()) + return false; + /* THP settings require madvise. */ if (!(vm_flags & VM_HUGEPAGE) && !khugepaged_always()) return false; _ 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