@@ -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
@@ -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 0;
+
+ return hint_addr;
+}
+
+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,
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@google.com> --- arch/powerpc/include/asm/book3s/64/slice.h | 1 + arch/powerpc/mm/book3s64/slice.c | 31 ++++++++++++++++++++++ 2 files changed, 32 insertions(+)