• Yang Shi's avatar
    mm: thp: kill __transhuge_page_enabled() · 7da4e2cb
    Yang Shi authored
    The page fault path checks THP eligibility with __transhuge_page_enabled()
    which does the similar thing as hugepage_vma_check(), so use
    hugepage_vma_check() instead.
    
    However page fault allows DAX and !anon_vma cases, so added a new flag,
    in_pf, to hugepage_vma_check() to make page fault work correctly.
    
    The in_pf flag is also used to skip shmem and file THP for page fault
    since shmem handles THP in its own shmem_fault() and file THP allocation
    on fault is not supported yet.
    
    Also remove hugepage_vma_enabled() since hugepage_vma_check() is the only
    caller now, it is not necessary to have a helper function.
    
    Link: https://lkml.kernel.org/r/20220616174840.1202070-6-shy828301@gmail.comSigned-off-by: default avatarYang Shi <shy828301@gmail.com>
    Reviewed-by: default avatarZach O'Keefe <zokeefe@google.com>
    Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Miaohe Lin <linmiaohe@huawei.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    7da4e2cb
task_mmu.c 48.4 KB