Re: [PATCH RFC v2 2/4] mm: Add hint and mmap_flags to struct vm_unmapped_area_info

From: Christophe Leroy
Date: Tue Sep 03 2024 - 13:18:45 EST


Hi Charlie,

Le 29/08/2024 à 09:15, Charlie Jenkins a écrit :
The hint address and mmap_flags are necessary to determine if
MAP_BELOW_HINT requirements are satisfied.

Signed-off-by: Charlie Jenkins <charlie@xxxxxxxxxxxx>
---
arch/alpha/kernel/osf_sys.c | 2 ++
arch/arc/mm/mmap.c | 3 +++
arch/arm/mm/mmap.c | 7 +++++++
arch/csky/abiv1/mmap.c | 3 +++
arch/loongarch/mm/mmap.c | 3 +++
arch/mips/mm/mmap.c | 3 +++
arch/parisc/kernel/sys_parisc.c | 3 +++
arch/powerpc/mm/book3s64/slice.c | 7 +++++++
arch/s390/mm/hugetlbpage.c | 4 ++++
arch/s390/mm/mmap.c | 6 ++++++
arch/sh/mm/mmap.c | 6 ++++++
arch/sparc/kernel/sys_sparc_32.c | 3 +++
arch/sparc/kernel/sys_sparc_64.c | 6 ++++++
arch/sparc/mm/hugetlbpage.c | 4 ++++
arch/x86/kernel/sys_x86_64.c | 6 ++++++
arch/x86/mm/hugetlbpage.c | 4 ++++
fs/hugetlbfs/inode.c | 4 ++++
include/linux/mm.h | 2 ++
mm/mmap.c | 6 ++++++
19 files changed, 82 insertions(+)


diff --git a/arch/powerpc/mm/book3s64/slice.c b/arch/powerpc/mm/book3s64/slice.c
index ef3ce37f1bb3..f0e2550af6d0 100644
--- a/arch/powerpc/mm/book3s64/slice.c
+++ b/arch/powerpc/mm/book3s64/slice.c
@@ -286,6 +286,10 @@ static unsigned long slice_find_area_bottomup(struct mm_struct *mm,
.length = len,
.align_mask = PAGE_MASK & ((1ul << pshift) - 1),
};
+
+ info.hint = addr;
+ info.mmap_flags = flags;
+
/*
* Check till the allow max value for this mmap request
*/
@@ -331,6 +335,9 @@ static unsigned long slice_find_area_topdown(struct mm_struct *mm,
};
unsigned long min_addr = max(PAGE_SIZE, mmap_min_addr);
+ info.hint = addr;
+ info.mmap_flags = flags;
+
/*
* If we are trying to allocate above DEFAULT_MAP_WINDOW
* Add the different to the mmap_base.

ppc64_defconfig:

CC arch/powerpc/mm/book3s64/slice.o
arch/powerpc/mm/book3s64/slice.c: In function 'slice_find_area_bottomup':
arch/powerpc/mm/book3s64/slice.c:291:27: error: 'flags' undeclared (first use in this function)
291 | info.mmap_flags = flags;
| ^~~~~
arch/powerpc/mm/book3s64/slice.c:291:27: note: each undeclared identifier is reported only once for each function it appears in
arch/powerpc/mm/book3s64/slice.c: In function 'slice_find_area_topdown':
arch/powerpc/mm/book3s64/slice.c:339:27: error: 'flags' undeclared (first use in this function)
339 | info.mmap_flags = flags;
| ^~~~~
make[5]: *** [scripts/Makefile.build:244: arch/powerpc/mm/book3s64/slice.o] Error 1