[PATCH 4/8] arch/s390: Stop special-casing hugetlb mappings in arch_get_unmapped_area
From: Oscar Salvador
Date: Fri Jun 05 2026 - 23:51:00 EST
arch_get_unmapped_area* sets info.align_mask to make room for extra alignment,
so that is added on top of the length we request 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.
So, stop special-casing hugetlb in arch_get_unmapped_area* functions.
Also, there is no need to worry about align_offset because that will be
masked off back in hugetlb_get_unmapped_area().
Signed-off-by: Oscar Salvador <osalvador@xxxxxxx>
---
arch/s390/mm/mmap.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c
index 2a222a7e14f4..46c29738c5ef 100644
--- a/arch/s390/mm/mmap.c
+++ b/arch/s390/mm/mmap.c
@@ -16,7 +16,6 @@
#include <linux/sched/mm.h>
#include <linux/random.h>
#include <linux/security.h>
-#include <linux/hugetlb.h>
#include <asm/elf.h>
static unsigned long stack_maxrandom_size(void)
@@ -66,8 +65,6 @@ static inline unsigned long mmap_base(unsigned long rnd,
static int get_align_mask(struct file *filp, unsigned long flags)
{
- if (filp && is_file_hugepages(filp))
- return huge_page_mask_align(filp);
if (!(current->flags & PF_RANDOMIZE))
return 0;
if (filp || (flags & MAP_SHARED))
@@ -101,8 +98,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
info.low_limit = mm->mmap_base;
info.high_limit = TASK_SIZE;
info.align_mask = get_align_mask(filp, flags);
- if (!(filp && is_file_hugepages(filp)))
- info.align_offset = pgoff << PAGE_SHIFT;
+ info.align_offset = pgoff << PAGE_SHIFT;
addr = vm_unmapped_area(&info);
if (offset_in_page(addr))
return addr;
@@ -140,8 +136,7 @@ unsigned long arch_get_unmapped_area_topdown(struct file *filp, unsigned long ad
info.low_limit = PAGE_SIZE;
info.high_limit = mm->mmap_base;
info.align_mask = get_align_mask(filp, flags);
- if (!(filp && is_file_hugepages(filp)))
- info.align_offset = pgoff << PAGE_SHIFT;
+ info.align_offset = pgoff << PAGE_SHIFT;
addr = vm_unmapped_area(&info);
/*
--
2.35.3