Commit 2cb4de08 authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

mm: Add len and flags parameters to arch_get_mmap_end()

Powerpc needs flags and len to make decision on arch_get_mmap_end().

So add them as parameters to arch_get_mmap_end().
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Acked-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/b556daabe7d2bdb2361c4d6130280da7c1ba2c14.1649523076.git.christophe.leroy@csgroup.eu
parent 4b439e25
...@@ -92,8 +92,8 @@ ...@@ -92,8 +92,8 @@
#endif /* CONFIG_COMPAT */ #endif /* CONFIG_COMPAT */
#ifndef CONFIG_ARM64_FORCE_52BIT #ifndef CONFIG_ARM64_FORCE_52BIT
#define arch_get_mmap_end(addr) ((addr > DEFAULT_MAP_WINDOW) ? TASK_SIZE :\ #define arch_get_mmap_end(addr, len, flags) \
DEFAULT_MAP_WINDOW) (((addr) > DEFAULT_MAP_WINDOW) ? TASK_SIZE : DEFAULT_MAP_WINDOW)
#define arch_get_mmap_base(addr, base) ((addr > DEFAULT_MAP_WINDOW) ? \ #define arch_get_mmap_base(addr, base) ((addr > DEFAULT_MAP_WINDOW) ? \
base + TASK_SIZE - DEFAULT_MAP_WINDOW :\ base + TASK_SIZE - DEFAULT_MAP_WINDOW :\
......
...@@ -205,7 +205,7 @@ hugetlb_get_unmapped_area_bottomup(struct file *file, unsigned long addr, ...@@ -205,7 +205,7 @@ hugetlb_get_unmapped_area_bottomup(struct file *file, unsigned long addr,
info.flags = 0; info.flags = 0;
info.length = len; info.length = len;
info.low_limit = current->mm->mmap_base; info.low_limit = current->mm->mmap_base;
info.high_limit = arch_get_mmap_end(addr); info.high_limit = arch_get_mmap_end(addr, len, flags);
info.align_mask = PAGE_MASK & ~huge_page_mask(h); info.align_mask = PAGE_MASK & ~huge_page_mask(h);
info.align_offset = 0; info.align_offset = 0;
return vm_unmapped_area(&info); return vm_unmapped_area(&info);
...@@ -236,7 +236,7 @@ hugetlb_get_unmapped_area_topdown(struct file *file, unsigned long addr, ...@@ -236,7 +236,7 @@ hugetlb_get_unmapped_area_topdown(struct file *file, unsigned long addr,
VM_BUG_ON(addr != -ENOMEM); VM_BUG_ON(addr != -ENOMEM);
info.flags = 0; info.flags = 0;
info.low_limit = current->mm->mmap_base; info.low_limit = current->mm->mmap_base;
info.high_limit = arch_get_mmap_end(addr); info.high_limit = arch_get_mmap_end(addr, len, flags);
addr = vm_unmapped_area(&info); addr = vm_unmapped_area(&info);
} }
...@@ -251,7 +251,7 @@ generic_hugetlb_get_unmapped_area(struct file *file, unsigned long addr, ...@@ -251,7 +251,7 @@ generic_hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
struct mm_struct *mm = current->mm; struct mm_struct *mm = current->mm;
struct vm_area_struct *vma; struct vm_area_struct *vma;
struct hstate *h = hstate_file(file); struct hstate *h = hstate_file(file);
const unsigned long mmap_end = arch_get_mmap_end(addr); const unsigned long mmap_end = arch_get_mmap_end(addr, len, flags);
if (len & ~huge_page_mask(h)) if (len & ~huge_page_mask(h))
return -EINVAL; return -EINVAL;
......
...@@ -137,7 +137,7 @@ static inline void mm_update_next_owner(struct mm_struct *mm) ...@@ -137,7 +137,7 @@ static inline void mm_update_next_owner(struct mm_struct *mm)
#ifdef CONFIG_MMU #ifdef CONFIG_MMU
#ifndef arch_get_mmap_end #ifndef arch_get_mmap_end
#define arch_get_mmap_end(addr) (TASK_SIZE) #define arch_get_mmap_end(addr, len, flags) (TASK_SIZE)
#endif #endif
#ifndef arch_get_mmap_base #ifndef arch_get_mmap_base
......
...@@ -2136,7 +2136,7 @@ generic_get_unmapped_area(struct file *filp, unsigned long addr, ...@@ -2136,7 +2136,7 @@ generic_get_unmapped_area(struct file *filp, unsigned long addr,
struct mm_struct *mm = current->mm; struct mm_struct *mm = current->mm;
struct vm_area_struct *vma, *prev; struct vm_area_struct *vma, *prev;
struct vm_unmapped_area_info info; struct vm_unmapped_area_info info;
const unsigned long mmap_end = arch_get_mmap_end(addr); const unsigned long mmap_end = arch_get_mmap_end(addr, len, flags);
if (len > mmap_end - mmap_min_addr) if (len > mmap_end - mmap_min_addr)
return -ENOMEM; return -ENOMEM;
...@@ -2184,7 +2184,7 @@ generic_get_unmapped_area_topdown(struct file *filp, unsigned long addr, ...@@ -2184,7 +2184,7 @@ generic_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
struct vm_area_struct *vma, *prev; struct vm_area_struct *vma, *prev;
struct mm_struct *mm = current->mm; struct mm_struct *mm = current->mm;
struct vm_unmapped_area_info info; struct vm_unmapped_area_info info;
const unsigned long mmap_end = arch_get_mmap_end(addr); const unsigned long mmap_end = arch_get_mmap_end(addr, len, flags);
/* requested length too big for entire address space */ /* requested length too big for entire address space */
if (len > mmap_end - mmap_min_addr) if (len > mmap_end - mmap_min_addr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment