mm-hugetlb-refactor-out-hugetlb_alloc_folio.patch removed from -mm tree
The quilt patch titled
Subject: mm: hugetlb: refactor out hugetlb_alloc_folio()
has been removed from the -mm tree. Its filename was
mm-hugetlb-refactor-out-hugetlb_alloc_folio.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Ackerley Tng <[email protected]>
Subject: mm: hugetlb: refactor out hugetlb_alloc_folio()
Date: Thu, 02 Jul 2026 09:21:50 -0700
Refactor out hugetlb_alloc_folio() from alloc_hugetlb_folio(), which handles allocation of a folio and memory and HugeTLB charging to cgroups.
This refactoring decouples the HugeTLB page allocation from VMAs, specifically:
1. Reservations (as in resv_map) are stored in the vma
2. mpol is stored at vma->vm_policy
3. A vma must be used for allocation even if the pages are not meant to be used by host process.
Without this coupling, VMAs are no longer a requirement for allocation. This opens up the allocation routine for usage without VMAs, which will allow guest_memfd to use HugeTLB as a more generic allocator of huge pages, since guest_memfd memory may not have any associated VMAs by design. In addition, direct allocations from HugeTLB could possibly be refactored to avoid the use of a pseudo-VMA.
Also, this decouples HugeTLB page allocation from HugeTLBfs, where the subpool is stored at the fs mount. This is also a requirement for guest_memfd, where the plan is to have a subpool created per-fd and stored on the inode.
Provide and use alloc_flags to allow more allocation knobs in future without expanding the number of parameters in hugetlb_alloc_folio().
No functional change intended.
---
include/linux/hugetlb.h | 18 +++ mm/hugetlb.c | 206 ++++++++++++++++++++------------------ 2 files changed, 131 insertions(+), 93 deletions(-)
include/linux/hugetlb.h renamed from include/linux/hugetlb.h~mm-hugetlb-refactor-out-hugetlb_alloc_folio +18 -0
@@ -2,6 +2,7 @@#ifndef _LINUX_HUGETLB_H#define _LINUX_HUGETLB_H +#include <linux/mempolicy.h> #include <linux/mm.h> #include <linux/mm_types.h> #include <linux/mmdebug.h>
@@ -682,6 +683,23 @@ struct hstate {int isolate_or_dissolve_huge_folio (struct folio *folio,struct list_head *list);int replace_free_hugepage_folios (unsigned long start_pfn,unsigned long end_pfn);void wait_for_freed_hugetlb_folios (void ); + +struct mempolicy_interpreted { +int nid; +nodemask_t *nodemask; +enum mempolicy_mode mode; +}; + +enum hugetlb_alloc_flag { +HUGETLB_ALLOC_CHARGE_CGROUP_RSVD_BIT =0 , +HUGETLB_ALLOC_USE_GLOBAL_RESERVATIONS_BIT , +}; + +#define HUGETLB_ALLOC_CHARG_CGROUP_RSVD BIT(HUGETLB_ALLOC_CHARGE_CGROUP_RSVD_BIT) +#define HUGETLB_ALLOC_USE_GLOBAL_RESERVATIONS BIT(HUGETLB_ALLOC_USE_GLOBAL_RESERVATIONS_BIT) + +struct folio *hugetlb_alloc_folio (struct hstate *h, +struct mempolicy_interpreted *mpoli,u8 alloc_flags);struct folio *alloc_hugetlb_folio (struct vm_area_struct *vma,unsigned long addr,bool cow_from_owner); struct folio *alloc_hugetlb_folio_nodemask(struct hstate *h, int preferred_nid,
mm/hugetlb.c renamed from mm/hugetlb.c~mm-hugetlb-refactor-out-hugetlb_alloc_folio +113 -93
258 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are