The patch titled Subject: mm: powerpc: introduce arch_mmap_hint() has been added to the -mm mm-unstable branch. Its filename is mm-powerpc-introduce-arch_mmap_hint.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-powerpc-introduce-arch_mmap_hint.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Kalesh Singh <kaleshsingh@xxxxxxxxxx> Subject: mm: powerpc: introduce arch_mmap_hint() Date: Wed, 11 Dec 2024 15:27:53 -0800 Introduce powerpc arch_mmap_hint() and define HAVE_ARCH_MMAP_HINT. This is a preparatory patch, no functional change is introduced. Link: https://lkml.kernel.org/r/20241211232754.1583023-16-kaleshsingh@xxxxxxxxxx Signed-off-by: Kalesh Singh <kaleshsingh@xxxxxxxxxx> Cc: Andreas Larsson <andreas@xxxxxxxxxxx> Cc: Bjorn Helgaas <bhelgaas@xxxxxxxxxx> Cc: Borislav Petkov (AMD) <bp@xxxxxxxxx> Cc: Breno Leitao <leitao@xxxxxxxxxx> Cc: Chris Zankel <chris@xxxxxxxxxx> Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx> Cc: David Hildenbrand <david@xxxxxxxxxx> Cc: David S. Miller <davem@xxxxxxxxxxxxx> Cc: James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx> Cc: Jason Andryuk <jason.andryuk@xxxxxxx> Cc: John Paul Adrian Glaubitz <glaubitz@xxxxxxxxxxxxxxxxxxx> Cc: Max Filippov <jcmvbkbc@xxxxxxxxx> Cc: Minchan Kim <minchan@xxxxxxxxxx> Cc: Rich Felker <dalias@xxxxxxxx> Cc: Rik van Riel <riel@xxxxxxxxxxx> Cc: Russell King <linux@xxxxxxxxxxxxxxx> Cc: Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Cc: Yang Shi <yang@xxxxxxxxxxxxxxxxxxxxxx> Cc: Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- arch/powerpc/include/asm/book3s/64/slice.h | 1 arch/powerpc/mm/book3s64/slice.c | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+) --- a/arch/powerpc/include/asm/book3s/64/slice.h~mm-powerpc-introduce-arch_mmap_hint +++ a/arch/powerpc/include/asm/book3s/64/slice.h @@ -10,6 +10,7 @@ #endif #define HAVE_ARCH_UNMAPPED_AREA #define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN +#define HAVE_ARCH_MMAP_HINT #endif #define SLICE_LOW_SHIFT 28 --- a/arch/powerpc/mm/book3s64/slice.c~mm-powerpc-introduce-arch_mmap_hint +++ a/arch/powerpc/mm/book3s64/slice.c @@ -647,6 +647,37 @@ static int file_to_psize(struct file *fi } #endif +static unsigned long slice_mmap_hint(unsigned long addr, unsigned long len, + unsigned long flags, unsigned int psize) +{ + unsigned long hint_addr = slice_get_unmapped_area(addr, len, flags, psize, 0); + + if (IS_ERR_VALUE(hint_addr) || hint_addr == PAGE_ALIGN(addr)) + return hint_addr; + + return 0; +} + +unsigned long arch_mmap_hint(struct file *filp, unsigned long addr, + unsigned long len, unsigned long pgoff, + unsigned long flags) +{ + unsigned int psize; + + if (!addr) + return 0; + + if (radix_enabled()) + return generic_mmap_hint(filp, addr, len, pgoff, flags); + + if (filp && is_file_hugepages(filp)) + psize = file_to_psize(filp); + else + psize = mm_ctx_user_psize(¤t->mm->context); + + return slice_mmap_hint(addr, len, flags, psize); +} + unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsigned long len, _ Patches currently in -mm which might be from kaleshsingh@xxxxxxxxxx are mm-introduce-generic_mmap_hint.patch mm-x86-introduce-arch_mmap_hint.patch mm-arm-introduce-arch_mmap_hint.patch mm-alpha-introduce-arch_mmap_hint.patch mm-arc-use-generic_mmap_hint.patch mm-csky-introduce-arch_mmap_hint.patch mm-loongarch-introduce-arch_mmap_hint.patch mm-mips-introduce-arch_align_mmap_hint.patch mm-parisc-introduce-arch_align_mmap_hint.patch mm-s390-use-generic_mmap_hint.patch mm-sh-introduce-arch_mmap_hint.patch mm-sparc32-introduce-arch_mmap_hint.patch mm-sparc64-introduce-arch_mmap_hint.patch mm-xtensa-introduce-arch_mmap_hint.patch mm-powerpc-introduce-arch_mmap_hint.patch mm-respect-mmap-hint-before-thp-alignment-if-allocation-is-possible.patch