]> www.infradead.org Git - users/willy/pagecache.git/commitdiff
mm/khugepaged: Allocate folios
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Sat, 8 May 2021 03:40:19 +0000 (23:40 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Tue, 3 Jan 2023 04:09:03 +0000 (23:09 -0500)
khugepaged only wants to deal in terms of folios, so switch to
using the folio allocation functions.  This eliminates the calls to
prep_transhuge_page() and saves dozens of bytes of text.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
mm/khugepaged.c

index 5cb401aa2b9d8b424462f4bded8511491d1c7045..39c54ea0b6bc06f41ff5e9c0a356baea148fc25c 100644 (file)
@@ -799,14 +799,15 @@ static int hpage_collapse_find_target_node(struct collapse_control *cc)
 static bool hpage_collapse_alloc_page(struct page **hpage, gfp_t gfp, int node,
                                      nodemask_t *nmask)
 {
-       *hpage = __alloc_pages(gfp, HPAGE_PMD_ORDER, node, nmask);
-       if (unlikely(!*hpage)) {
+       struct folio *folio = __folio_alloc(gfp, HPAGE_PMD_ORDER, node, nmask);
+
+       if (unlikely(!folio)) {
                count_vm_event(THP_COLLAPSE_ALLOC_FAILED);
                return false;
        }
 
-       prep_transhuge_page(*hpage);
        count_vm_event(THP_COLLAPSE_ALLOC);
+       *hpage = &folio->page;
        return true;
 }