[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241211232754.1583023-16-kaleshsingh@google.com>
Date: Wed, 11 Dec 2024 15:27:53 -0800
From: Kalesh Singh <kaleshsingh@...gle.com>
To: akpm@...ux-foundation.org, vbabka@...e.cz, yang@...amperecomputing.com,
riel@...riel.com, david@...hat.com, minchan@...nel.org, jyescas@...gle.com
Cc: linux@...linux.org.uk, tsbogend@...ha.franken.de,
James.Bottomley@...senPartnership.com, ysato@...rs.sourceforge.jp,
dalias@...c.org, glaubitz@...sik.fu-berlin.de, davem@...emloft.net,
andreas@...sler.com, tglx@...utronix.de, bp@...en8.de,
dave.hansen@...ux.intel.com, x86@...nel.org, chris@...kel.net,
jcmvbkbc@...il.com, bhelgaas@...gle.com, jason.andryuk@....com,
leitao@...ian.org, linux-alpha@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-snps-arc@...ts.infradead.org, linux-arm-kernel@...ts.infradead.org,
linux-csky@...r.kernel.org, loongarch@...ts.linux.dev,
linux-mips@...r.kernel.org, linux-parisc@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org, linux-s390@...r.kernel.org,
linux-sh@...r.kernel.org, sparclinux@...r.kernel.org, linux-mm@...ck.org,
kernel-team@...roid.com, android-mm@...gle.com,
Kalesh Singh <kaleshsingh@...gle.com>
Subject: [PATCH mm-unstable v2 15/16] mm: powerpc: Introduce arch_mmap_hint()
Introduce powerpc arch_mmap_hint() and define HAVE_ARCH_MMAP_HINT.
This is a preparatory patch, no functional change is introduced.
Signed-off-by: Kalesh Singh <kaleshsingh@...gle.com>
---
arch/powerpc/include/asm/book3s/64/slice.h | 1 +
arch/powerpc/mm/book3s64/slice.c | 31 ++++++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/arch/powerpc/include/asm/book3s/64/slice.h b/arch/powerpc/include/asm/book3s/64/slice.h
index 5fbe18544cbd..89f629080e90 100644
--- a/arch/powerpc/include/asm/book3s/64/slice.h
+++ b/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
diff --git a/arch/powerpc/mm/book3s64/slice.c b/arch/powerpc/mm/book3s64/slice.c
index bc9a39821d1c..b4067c57c778 100644
--- a/arch/powerpc/mm/book3s64/slice.c
+++ b/arch/powerpc/mm/book3s64/slice.c
@@ -647,6 +647,37 @@ static int file_to_psize(struct file *file)
}
#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,
--
2.47.0.338.g60cca15819-goog
Powered by blists - more mailing lists