]> git.baikalelectronics.ru Git - kernel.git/commit
mm: thp: consolidate vma size check to transhuge_vma_suitable
authorYang Shi <shy828301@gmail.com>
Thu, 16 Jun 2022 17:48:35 +0000 (10:48 -0700)
committerakpm <akpm@linux-foundation.org>
Mon, 18 Jul 2022 00:14:32 +0000 (17:14 -0700)
commitfb677b3986b8156cc370a5c773689d12fa0825da
tree7532fd0bfbd6e862925e539a2c7fad8cde5d8bb5
parent5ee852d05d9fa913f089a2f7f1c4d8ea16b5220f
mm: thp: consolidate vma size check to transhuge_vma_suitable

There are couple of places that check whether the vma size is ok for THP
or whether address fits, they are open coded and duplicate, use
transhuge_vma_suitable() to do the job by passing in (vma->end -
HPAGE_PMD_SIZE).

Move vma size check into hugepage_vma_check().  This will make
khugepaged_enter() is as same as khugepaged_enter_vma().  There is just
one caller for khugepaged_enter(), replace it to khugepaged_enter_vma()
and remove khugepaged_enter().

Link: https://lkml.kernel.org/r/20220616174840.1202070-3-shy828301@gmail.com
Signed-off-by: Yang Shi <shy828301@gmail.com>
Reviewed-by: Zach 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: Andrew Morton <akpm@linux-foundation.org>
include/linux/huge_mm.h
include/linux/khugepaged.h
mm/huge_memory.c
mm/khugepaged.c