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>
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;
}