[PATCH 2/8] mm/mmap: Stop special-casing hugetlb in generic_get_unmapped_area path

From: Oscar Salvador

Date: Fri Jun 05 2026 - 23:52:33 EST


generic_get_unmapped_area* sets info.align_mask to make room for extra alignment,
so that is added on top of the length we requested in unmapped_area{_topdown}.
hugetlb_get_unmapped_area() already adds this extra padding in the 'len'
parameter, and it also masks off the address it gets to properly align it to
the huge_page_size we are using.

Stop special-casing hugetlb in generic_get_unmapped_area* functions.

Signed-off-by: Oscar Salvador <osalvador@xxxxxxx>
---
mm/mmap.c | 4 ----
1 file changed, 4 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 5754d1c36462..e4defe9fb1b7 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -715,8 +715,6 @@ generic_get_unmapped_area(struct file *filp, unsigned long addr,
info.low_limit = mm->mmap_base;
info.high_limit = mmap_end;
info.start_gap = stack_guard_placement(vm_flags);
- if (filp && is_file_hugepages(filp))
- info.align_mask = huge_page_mask_align(filp);
return vm_unmapped_area(&info);
}

@@ -767,8 +765,6 @@ generic_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
info.low_limit = PAGE_SIZE;
info.high_limit = arch_get_mmap_base(addr, mm->mmap_base);
info.start_gap = stack_guard_placement(vm_flags);
- if (filp && is_file_hugepages(filp))
- info.align_mask = huge_page_mask_align(filp);
addr = vm_unmapped_area(&info);

/*
--
2.35.3