mm: Remove mm argument from mm_get_unmapped_area()
Subsystems (15)
PATCH 1/1 mm: Remove mm argument from mm_get_unmapped_area()
Recently the get_unmapped_area() pointer on mm_struct was removed in favor of direct callable function that can determines which of two handlers to call based on an mm flag. This function, mm_get_unmapped_area(), checks the flag of the mm passed as an argument.
Dan Williams pointed out (see link) that all callers pass curret->mm, so the mm argument is unneeded. It could be conceivable for a caller to want to pass a different mm in the future, but in this case a new helper could easily be added.
So remove the mm argument, and rename the function current_get_unmapped_area().
---
Based on linux-next.
--- arch/sparc/kernel/sys_sparc_64.c | 9 +++++---- arch/x86/kernel/cpu/sgx/driver.c | 2 +- drivers/char/mem.c | 2 +- drivers/dax/device.c | 6 +++--- fs/proc/inode.c | 2 +- fs/ramfs/file-mmu.c | 2 +- include/linux/sched/mm.h | 6 +++--- io_uring/memmap.c | 2 +- kernel/bpf/arena.c | 2 +- kernel/bpf/syscall.c | 2 +- mm/mmap.c | 11 +++++------ mm/shmem.c | 9 ++++----- 12 files changed, 27 insertions(+), 28 deletions(-)
arch/sparc/kernel/sys_sparc_64.c +5 -4
@@ -220,7 +220,7 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, uif (flags &MAP_FIXED ) {/* Ok, don't mess with it. */ -return mm_get_unmapped_area (current->mm,NULL , orig_addr, len, pgoff, flags); +return current_get_unmapped_area (NULL , orig_addr, len, pgoff, flags); } flags &= ~MAP_SHARED ;
@@ -233,8 +233,9 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u align_goal = (64UL *1024 ); do { - addr = mm_get_unmapped_area(current->mm, NULL, orig_addr, - len + (align_goal - PAGE_SIZE), pgoff, flags); + addr = current_get_unmapped_area(NULL, orig_addr, + len + (align_goal - PAGE_SIZE), + pgoff, flags); if (!(addr & ~PAGE_MASK)) { addr = (addr + (align_goal - 1UL)) & ~(align_goal - 1UL); break;
@@ -252,7 +253,7 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u* be obtained. */ if (addr & ~PAGE_MASK ) - addr =mm_get_unmapped_area (current->mm,NULL , orig_addr, len, pgoff, flags); + addr =current_get_unmapped_area (NULL , orig_addr, len, pgoff, flags);return addr; }
arch/x86/kernel/cpu/sgx/driver.c +1 -1
@@ -113,7 +113,7 @@ static unsigned long sgx_get_unmapped_area(struct file *file,if (flags &MAP_FIXED )return addr; -return mm_get_unmapped_area (current->mm, file, addr, len, pgoff, flags); +return current_get_unmapped_area (file, addr, len, pgoff, flags); }#ifdef CONFIG_COMPAT
drivers/char/mem.c +1 -1
@@ -546,7 +546,7 @@ static unsigned long get_unmapped_area_zero(struct file *file, }/* Otherwise flags & MAP_PRIVATE: with no shmem object beneath it */ -return mm_get_unmapped_area (current->mm, file, addr, len, pgoff, flags); +return current_get_unmapped_area (file, addr, len, pgoff, flags);#else return -ENOSYS ;#endif
drivers/dax/device.c +3 -3
@@ -329,14 +329,14 @@ static unsigned long dax_get_unmapped_area(struct file *filp,if ((off + len_align) < off) goto out; - addr_align =mm_get_unmapped_area (current->mm, filp, addr, len_align, - pgoff, flags); + addr_align =current_get_unmapped_area (filp, addr, len_align, + pgoff, flags);if (!IS_ERR_VALUE (addr_align)) { addr_align += (off - addr_align) & (align -1 );return addr_align; } out: -return mm_get_unmapped_area (current->mm, filp, addr, len, pgoff, flags); +return current_get_unmapped_area (filp, addr, len, pgoff, flags); }static const struct address_space_operations dev_dax_aops = {
fs/proc/inode.c +1 -1
@@ -455,7 +455,7 @@ pde_get_unmapped_area(struct proc_dir_entry *pde, struct file *file, unsigned loreturn pde->proc_ops->proc_get_unmapped_area (file, orig_addr, len, pgoff, flags);#ifdef CONFIG_MMU -return mm_get_unmapped_area (current->mm, file, orig_addr, len, pgoff, flags); +return current_get_unmapped_area (file, orig_addr, len, pgoff, flags);#endif return orig_addr;
fs/ramfs/file-mmu.c +1 -1
@@ -35,7 +35,7 @@ static unsigned long ramfs_mmu_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) { - return mm_get_unmapped_area(current->mm, file, addr, len, pgoff, flags); + return current_get_unmapped_area(file, addr, len, pgoff, flags); } const struct file_operations ramfs_file_operations = {
include/linux/sched/mm.h +3 -3
@@ -187,9 +187,9 @@ arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags); -unsigned long mm_get_unmapped_area (struct mm_struct *mm,struct file *filp, -unsigned long addr,unsigned long len, -unsigned long pgoff,unsigned long flags); +unsigned long current_get_unmapped_area (struct file *filp,unsigned long addr, +unsigned long len,unsigned long pgoff, +unsigned long flags); unsigned long arch_get_unmapped_area_vmflags(struct file *filp, unsigned long addr,
io_uring/memmap.c +1 -1
@@ -305,7 +305,7 @@ unsigned long io_uring_get_unmapped_area(struct file *filp, unsigned long addr,#else addr =0UL ;#endif -return mm_get_unmapped_area (current->mm, filp, addr, len, pgoff, flags); +return current_get_unmapped_area (filp, addr, len, pgoff, flags); }#else /* !CONFIG_MMU */
kernel/bpf/arena.c +1 -1
@@ -314,7 +314,7 @@ static unsigned long arena_get_unmapped_area(struct file *filp, unsigned long adreturn -EINVAL ; } - ret =mm_get_unmapped_area (current->mm, filp, addr, len *2 ,0 , flags); + ret =current_get_unmapped_area (filp, addr, len *2 ,0 , flags);if (IS_ERR_VALUE (ret))return ret;if ((ret >>32 ) == ((ret + len -1 ) >>32 ))
kernel/bpf/syscall.c +1 -1
@@ -992,7 +992,7 @@ static unsigned long bpf_get_unmapped_area(struct file *filp, unsigned long addrif (map->ops->map_get_unmapped_area)return map->ops->map_get_unmapped_area (filp, addr, len, pgoff, flags);#ifdef CONFIG_MMU -return mm_get_unmapped_area (current->mm, filp, addr, len, pgoff, flags); +return current_get_unmapped_area (filp, addr, len, pgoff, flags);#else return addr;#endif
mm/mmap.c +5 -6
@@ -1901,16 +1901,15 @@ __get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,return error ? error : addr; } -unsigned long -mm_get_unmapped_area (struct mm_struct *mm,struct file *file, -unsigned long addr,unsigned long len, -unsigned long pgoff,unsigned long flags) +unsigned long current_get_unmapped_area (struct file *file,unsigned long addr, +unsigned long len,unsigned long pgoff, +unsigned long flags) { -if (test_bit (MMF_TOPDOWN , &mm->flags)) +if (test_bit (MMF_TOPDOWN , ¤t->mm->flags))return arch_get_unmapped_area_topdown (file, addr, len, pgoff, flags);return arch_get_unmapped_area (file, addr, len, pgoff, flags); } -EXPORT_SYMBOL (mm_get_unmapped_area); +EXPORT_SYMBOL (current_get_unmapped_area);/** * find_vma_intersection() - Look up the first VMA which intersects the interval
mm/shmem.c +4 -5
@@ -2276,8 +2276,7 @@ unsigned long shmem_get_unmapped_area(struct file *file,if (len >TASK_SIZE )return -ENOMEM ; - addr =mm_get_unmapped_area (current->mm, file, uaddr, len, pgoff, - flags); + addr =current_get_unmapped_area (file, uaddr, len, pgoff, flags);if (!IS_ENABLED (CONFIG_TRANSPARENT_HUGEPAGE ))return addr;
@@ -2334,8 +2333,8 @@ unsigned long shmem_get_unmapped_area(struct file *file,if (inflated_len < len)return addr; - inflated_addr =mm_get_unmapped_area (current->mm,NULL , uaddr, - inflated_len,0 , flags); + inflated_addr =current_get_unmapped_area (NULL , uaddr, + inflated_len,0 , flags);if (IS_ERR_VALUE (inflated_addr))return addr;if (inflated_addr & ~PAGE_MASK )
@@ -4799,7 +4798,7 @@ unsigned long shmem_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) { - return mm_get_unmapped_area(current->mm, file, addr, len, pgoff, flags); + return current_get_unmapped_area(file, addr, len, pgoff, flags); }#endif
base-commit: 9221b2819b8a4196eecf5476d66201be60fbcf29
Signature · 1 line
2.34.1
arch/sparc/kernel/sys_sparc_64.c unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u · line 223
Quoted 4 lines · Rick Edgecombe
arch/sparc/kernel/sys_sparc_64.c +1
-1if (flags &MAP_FIXED ) {/* Ok, don't mess with it. */ -return mm_get_unmapped_area (current->mm,NULL , orig_addr, len, pgoff, flags); +return current_get_unmapped_area (NULL , orig_addr, len, pgoff, flags);
The old name seems preferable because it's not as crazy long. In fact just get_unmapped_area would be even better, but that's already taken by something else.
Can we maybe take a step back and sort out the mess of the various _get_unmapped_area helpers?
e.g. mm_get_unmapped_area_vmflags just wraps arch_get_unmapped_area_topdown_vmflags and arch_get_unmapped_area_vmflags, and we might as well merge all three by moving the MMF_TOPDOWN into two actual implementations?
And then just update all the implementations to always pass the vm_flags instead of having separate implementations with our without the flags.
And then make __get_unmapped_area static in mmap.c nad move the get_unmapped_area wrappers there. And eventually write some documentation for the functions based on the learnings who actually uses what..
Quoted 11 lines · Christoph Hellwig
Quoted 11 lines · Rick Edgecombe
Quoted 6 lines
Quoted 6 lines
if (flags &
MAP_FIXED) {
/* Ok, don't mess with it. */
- returnmm_get_unmapped_area(current->mm, NULL, orig_addr, > > len, pgoff, flags);
+ return current_get_unmapped_area(NULL,orig_addr, len, >Quoted 1 line
pgoff, flags);
The old name seems preferable because it's not as crazy long. In fact just
get_unmapped_areawould be even better, but that's already taken by something else.
Ok.
Quoted 9 lines
Quoted 9 lines
Can we maybe take a step back and sort out the mess of the various
_get_unmapped_areahelpers?e.g.
mm_get_unmapped_area_vmflagsjust wrapsarch_get_unmapped_area_topdown_vmflagsandarch_get_unmapped_area_vmflags, and we might as well merge all three by moving theMMF_TOPDOWNinto two actual implementations?
Quoted 8 lines
Quoted 8 lines
And then just update all the implementations to always pass the
vm_flagsinstead of having separate implementations with our without the flags.And then make
__get_unmapped_areastatic inmmap.cnad move theget_unmapped_areawrappers there. And eventually write some documentation for the functions based on the learnings who actually uses what..
The rest of the series[0] is in the mm-tree/linux-next currently. Are you suggesting we not do this patch, and leave the rest you describe here for the future? I think the removal of the indirect branch is at least a positive step forward.
Quoted 5 lines · Rick Edgecombe
Recently the
get_unmapped_area()pointer onmm_structwas removed in favor of direct callable function that can determines which of two handlers to call based on an mm flag. This function,mm_get_unmapped_area(), checks the flag of the mm passed as an argument.
Quoted 7 lines
Dan Williams pointed out (see link) that all callers pass
curret->mm, so the mm argument is unneeded. It could be conceivable for a caller to want to pass a different mm in the future, but in this case a new helper could easily be added.So remove the mm argument, and rename the function
current_get_unmapped_area().
I like this patch.
I think the context of current->mm is implied. IOW, could we call it get_unmapped_area() instead? There are other functions today that use current->mm that don't start with current_<whatever>. I probably should have responded to Dan's suggestion with my comment.
Either way, this is a minor thing so feel free to add:
Quoted 251 lines
Fixes 529ce23a764f ("mm: switch mm->get_unmapped_area() to a flag")Suggested-by Dan Williams <[email protected]>Signed-off-by Rick Edgecombe <[email protected]>---
Based on linux-next.--- arch/sparc/kernel/sys_sparc_64.c | 9 +++++---- arch/x86/kernel/cpu/sgx/driver.c | 2 +- drivers/char/mem.c | 2 +- drivers/dax/device.c | 6 +++--- fs/proc/inode.c | 2 +- fs/ramfs/file-mmu.c | 2 +- include/linux/sched/mm.h | 6 +++--- io_uring/memmap.c | 2 +- kernel/bpf/arena.c | 2 +- kernel/bpf/syscall.c | 2 +- mm/mmap.c | 11 +++++------ mm/shmem.c | 9 ++++----- 12 files changed, 27 insertions(+), 28 deletions(-)arch/sparc/kernel/sys_sparc_64.c +5
-4@@ -220,7 +220,7 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, uif (flags &MAP_FIXED ) {/* Ok, don't mess with it. */ -return mm_get_unmapped_area (current->mm,NULL , orig_addr, len, pgoff, flags); +return current_get_unmapped_area (NULL , orig_addr, len, pgoff, flags); } flags &= ~MAP_SHARED ;@@ -233,8 +233,9 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u align_goal = (64UL *1024 ); do { - addr = mm_get_unmapped_area(current->mm, NULL, orig_addr, - len + (align_goal - PAGE_SIZE), pgoff, flags); + addr = current_get_unmapped_area(NULL, orig_addr, + len + (align_goal - PAGE_SIZE), + pgoff, flags); if (!(addr & ~PAGE_MASK)) { addr = (addr + (align_goal - 1UL)) & ~(align_goal - 1UL); break;@@ -252,7 +253,7 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u* be obtained. */ if (addr & ~PAGE_MASK ) - addr =mm_get_unmapped_area (current->mm,NULL , orig_addr, len, pgoff, flags); + addr =current_get_unmapped_area (NULL , orig_addr, len, pgoff, flags);return addr; }arch/x86/kernel/cpu/sgx/driver.c +1
-1@@ -113,7 +113,7 @@ static unsigned long sgx_get_unmapped_area(struct file *file,if (flags &MAP_FIXED )return addr; -return mm_get_unmapped_area (current->mm, file, addr, len, pgoff, flags); +return current_get_unmapped_area (file, addr, len, pgoff, flags); }#ifdef CONFIG_COMPAT drivers/char/mem.c +1
-1@@ -546,7 +546,7 @@ static unsigned long get_unmapped_area_zero(struct file *file, }/* Otherwise flags & MAP_PRIVATE: with no shmem object beneath it */ -return mm_get_unmapped_area (current->mm, file, addr, len, pgoff, flags); +return current_get_unmapped_area (file, addr, len, pgoff, flags);#else return -ENOSYS ;#endif drivers/dax/device.c +3
-3@@ -329,14 +329,14 @@ static unsigned long dax_get_unmapped_area(struct file *filp,if ((off + len_align) < off) goto out; - addr_align =mm_get_unmapped_area (current->mm, filp, addr, len_align, - pgoff, flags); + addr_align =current_get_unmapped_area (filp, addr, len_align, + pgoff, flags);if (!IS_ERR_VALUE (addr_align)) { addr_align += (off - addr_align) & (align -1 );return addr_align; } out: -return mm_get_unmapped_area (current->mm, filp, addr, len, pgoff, flags); +return current_get_unmapped_area (filp, addr, len, pgoff, flags); }static const struct address_space_operations dev_dax_aops = {fs/proc/inode.c +1
-1@@ -455,7 +455,7 @@ pde_get_unmapped_area(struct proc_dir_entry *pde, struct file *file, unsigned loreturn pde->proc_ops->proc_get_unmapped_area (file, orig_addr, len, pgoff, flags);#ifdef CONFIG_MMU -return mm_get_unmapped_area (current->mm, file, orig_addr, len, pgoff, flags); +return current_get_unmapped_area (file, orig_addr, len, pgoff, flags);#endif return orig_addr;fs/ramfs/file-mmu.c +1
-1@@ -35,7 +35,7 @@ static unsigned long ramfs_mmu_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) { - return mm_get_unmapped_area(current->mm, file, addr, len, pgoff, flags); + return current_get_unmapped_area(file, addr, len, pgoff, flags); } const struct file_operations ramfs_file_operations = {include/linux/sched/mm.h +3
-3@@ -187,9 +187,9 @@ arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags); -unsigned long mm_get_unmapped_area (struct mm_struct *mm,struct file *filp, -unsigned long addr,unsigned long len, -unsigned long pgoff,unsigned long flags); +unsigned long current_get_unmapped_area (struct file *filp,unsigned long addr, +unsigned long len,unsigned long pgoff, +unsigned long flags); unsigned long arch_get_unmapped_area_vmflags(struct file *filp, unsigned long addr,io_uring/memmap.c +1
-1@@ -305,7 +305,7 @@ unsigned long io_uring_get_unmapped_area(struct file *filp, unsigned long addr,#else addr =0UL ;#endif -return mm_get_unmapped_area (current->mm, filp, addr, len, pgoff, flags); +return current_get_unmapped_area (filp, addr, len, pgoff, flags); }#else /* !CONFIG_MMU */ kernel/bpf/arena.c +1
-1@@ -314,7 +314,7 @@ static unsigned long arena_get_unmapped_area(struct file *filp, unsigned long adreturn -EINVAL ; } - ret =mm_get_unmapped_area (current->mm, filp, addr, len *2 ,0 , flags); + ret =current_get_unmapped_area (filp, addr, len *2 ,0 , flags);if (IS_ERR_VALUE (ret))return ret;if ((ret >>32 ) == ((ret + len -1 ) >>32 ))kernel/bpf/syscall.c +1
-1@@ -992,7 +992,7 @@ static unsigned long bpf_get_unmapped_area(struct file *filp, unsigned long addrif (map->ops->map_get_unmapped_area)return map->ops->map_get_unmapped_area (filp, addr, len, pgoff, flags);#ifdef CONFIG_MMU -return mm_get_unmapped_area (current->mm, filp, addr, len, pgoff, flags); +return current_get_unmapped_area (filp, addr, len, pgoff, flags);#else return addr;#endif mm/mmap.c +5
-6@@ -1901,16 +1901,15 @@ __get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,return error ? error : addr; } -unsigned long -mm_get_unmapped_area (struct mm_struct *mm,struct file *file, -unsigned long addr,unsigned long len, -unsigned long pgoff,unsigned long flags) +unsigned long current_get_unmapped_area (struct file *file,unsigned long addr, +unsigned long len,unsigned long pgoff, +unsigned long flags) { -if (test_bit (MMF_TOPDOWN , &mm->flags)) +if (test_bit (MMF_TOPDOWN , ¤t->mm->flags))return arch_get_unmapped_area_topdown (file, addr, len, pgoff, flags);return arch_get_unmapped_area (file, addr, len, pgoff, flags); } -EXPORT_SYMBOL (mm_get_unmapped_area); +EXPORT_SYMBOL (current_get_unmapped_area);/** * find_vma_intersection() - Look up the first VMA which intersects the interval mm/shmem.c +4
-5@@ -2276,8 +2276,7 @@ unsigned long shmem_get_unmapped_area(struct file *file,if (len >TASK_SIZE )return -ENOMEM ; - addr =mm_get_unmapped_area (current->mm, file, uaddr, len, pgoff, - flags); + addr =current_get_unmapped_area (file, uaddr, len, pgoff, flags);if (!IS_ENABLED (CONFIG_TRANSPARENT_HUGEPAGE ))return addr;@@ -2334,8 +2333,8 @@ unsigned long shmem_get_unmapped_area(struct file *file,if (inflated_len < len)return addr; - inflated_addr =mm_get_unmapped_area (current->mm,NULL , uaddr, - inflated_len,0 , flags); + inflated_addr =current_get_unmapped_area (NULL , uaddr, + inflated_len,0 , flags);if (IS_ERR_VALUE (inflated_addr))return addr;if (inflated_addr & ~PAGE_MASK )@@ -4799,7 +4798,7 @@ unsigned long shmem_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) { - return mm_get_unmapped_area(current->mm, file, addr, len, pgoff, flags); + return current_get_unmapped_area(file, addr, len, pgoff, flags); }#endif base-commit:
9221b2819b8a4196eecf5476d66201be60fbcf29Signature · 1 line
2.34.1
Quoted 2 lines · Liam R. Howlett
I like this patch.
Thanks for taking a look.
Quoted 5 lines
I think the context of
current->mmis implied. IOW, could we call itget_unmapped_area()instead? There are other functions today that usecurrent->mmthat don't start with current_<whatever>. I probably should have responded to Dan's suggestion with my comment.
Yes, get_unmapped_area() is already taken. What else to call it... It is kind of the process "default" get_unmapped_area(). But with Christoph's proposal it would basically be arch_get_unmapped_area().
Quoted 3 lines
Either way, this is a minor thing so feel free to add:
Reviewed-by Liam R. Howlett <[email protected]>
Quoted 7 lines · Edgecombe, Rick P
Quoted 2 lines · Liam R. Howlett
I like this patch.
Thanks for taking a look.
Quoted 1 line
Quoted 8 lines
Quoted 4 lines
I think the context of
current->mmis implied. IOW, could we call itget_unmapped_area()instead? There are other functions today that usecurrent->mmthat don't start with current_<whatever>. I probably should have responded to Dan's suggestion with my comment.Yes,
get_unmapped_area()is already taken. What else to call it... It is kind of the process "default"get_unmapped_area(). But with Christoph's proposal it would basically bearch_get_unmapped_area().
unmapped_area(), but that's also taken..
arch_get_unmapped_area() are all quite close. If you look into it, many of the arch versions were taken from the sparc 32 version. Subsequent changes were made and they are no longer exactly the same, but I believe functionally equivalent - rather tricky to test though.
I wanted to unite these to simplify the mm code a while back, but have not gotten back to it. One aspect that some archs have is "cache coloring" which does affect the VMAs.
The other difference is VDSO, which I may be looking into soon. Someone once called me a glutton for punishment and there may be some truth in that...
Cheers,
Liam
Quoted 259 lines · Rick Edgecombe
Recently the
get_unmapped_area()pointer onmm_structwas removed in favor of direct callable function that can determines which of two handlers to call based on an mm flag. This function,mm_get_unmapped_area(), checks the flag of the mm passed as an argument.Dan Williams pointed out (see link) that all callers pass
curret->mm, so the mm argument is unneeded. It could be conceivable for a caller to want to pass a different mm in the future, but in this case a new helper could easily be added.So remove the mm argument, and rename the function
current_get_unmapped_area().Fixes 529ce23a764f ("mm: switch mm->get_unmapped_area() to a flag")Suggested-by Dan Williams <[email protected]>Signed-off-by Rick Edgecombe <[email protected]>---
Based on linux-next.--- arch/sparc/kernel/sys_sparc_64.c | 9 +++++---- arch/x86/kernel/cpu/sgx/driver.c | 2 +- drivers/char/mem.c | 2 +- drivers/dax/device.c | 6 +++--- fs/proc/inode.c | 2 +- fs/ramfs/file-mmu.c | 2 +- include/linux/sched/mm.h | 6 +++--- io_uring/memmap.c | 2 +- kernel/bpf/arena.c | 2 +- kernel/bpf/syscall.c | 2 +- mm/mmap.c | 11 +++++------ mm/shmem.c | 9 ++++----- 12 files changed, 27 insertions(+), 28 deletions(-)arch/sparc/kernel/sys_sparc_64.c +5
-4@@ -220,7 +220,7 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, uif (flags &MAP_FIXED ) {/* Ok, don't mess with it. */ -return mm_get_unmapped_area (current->mm,NULL , orig_addr, len, pgoff, flags); +return current_get_unmapped_area (NULL , orig_addr, len, pgoff, flags); } flags &= ~MAP_SHARED ;@@ -233,8 +233,9 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u align_goal = (64UL *1024 ); do { - addr = mm_get_unmapped_area(current->mm, NULL, orig_addr, - len + (align_goal - PAGE_SIZE), pgoff, flags); + addr = current_get_unmapped_area(NULL, orig_addr, + len + (align_goal - PAGE_SIZE), + pgoff, flags); if (!(addr & ~PAGE_MASK)) { addr = (addr + (align_goal - 1UL)) & ~(align_goal - 1UL); break;@@ -252,7 +253,7 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u* be obtained. */ if (addr & ~PAGE_MASK ) - addr =mm_get_unmapped_area (current->mm,NULL , orig_addr, len, pgoff, flags); + addr =current_get_unmapped_area (NULL , orig_addr, len, pgoff, flags);return addr; }arch/x86/kernel/cpu/sgx/driver.c +1
-1@@ -113,7 +113,7 @@ static unsigned long sgx_get_unmapped_area(struct file *file,if (flags &MAP_FIXED )return addr; -return mm_get_unmapped_area (current->mm, file, addr, len, pgoff, flags); +return current_get_unmapped_area (file, addr, len, pgoff, flags); }#ifdef CONFIG_COMPAT drivers/char/mem.c +1
-1@@ -546,7 +546,7 @@ static unsigned long get_unmapped_area_zero(struct file *file, }/* Otherwise flags & MAP_PRIVATE: with no shmem object beneath it */ -return mm_get_unmapped_area (current->mm, file, addr, len, pgoff, flags); +return current_get_unmapped_area (file, addr, len, pgoff, flags);#else return -ENOSYS ;#endif drivers/dax/device.c +3
-3@@ -329,14 +329,14 @@ static unsigned long dax_get_unmapped_area(struct file *filp,if ((off + len_align) < off) goto out; - addr_align =mm_get_unmapped_area (current->mm, filp, addr, len_align, - pgoff, flags); + addr_align =current_get_unmapped_area (filp, addr, len_align, + pgoff, flags);if (!IS_ERR_VALUE (addr_align)) { addr_align += (off - addr_align) & (align -1 );return addr_align; } out: -return mm_get_unmapped_area (current->mm, filp, addr, len, pgoff, flags); +return current_get_unmapped_area (filp, addr, len, pgoff, flags); }static const struct address_space_operations dev_dax_aops = {fs/proc/inode.c +1
-1@@ -455,7 +455,7 @@ pde_get_unmapped_area(struct proc_dir_entry *pde, struct file *file, unsigned loreturn pde->proc_ops->proc_get_unmapped_area (file, orig_addr, len, pgoff, flags);#ifdef CONFIG_MMU -return mm_get_unmapped_area (current->mm, file, orig_addr, len, pgoff, flags); +return current_get_unmapped_area (file, orig_addr, len, pgoff, flags);#endif return orig_addr;fs/ramfs/file-mmu.c +1
-1@@ -35,7 +35,7 @@ static unsigned long ramfs_mmu_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) { - return mm_get_unmapped_area(current->mm, file, addr, len, pgoff, flags); + return current_get_unmapped_area(file, addr, len, pgoff, flags); } const struct file_operations ramfs_file_operations = {include/linux/sched/mm.h +3
-3@@ -187,9 +187,9 @@ arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags); -unsigned long mm_get_unmapped_area (struct mm_struct *mm,struct file *filp, -unsigned long addr,unsigned long len, -unsigned long pgoff,unsigned long flags); +unsigned long current_get_unmapped_area (struct file *filp,unsigned long addr, +unsigned long len,unsigned long pgoff, +unsigned long flags); unsigned long arch_get_unmapped_area_vmflags(struct file *filp, unsigned long addr,io_uring/memmap.c +1
-1@@ -305,7 +305,7 @@ unsigned long io_uring_get_unmapped_area(struct file *filp, unsigned long addr,#else addr =0UL ;#endif -return mm_get_unmapped_area (current->mm, filp, addr, len, pgoff, flags); +return current_get_unmapped_area (filp, addr, len, pgoff, flags); }#else /* !CONFIG_MMU */ kernel/bpf/arena.c +1
-1@@ -314,7 +314,7 @@ static unsigned long arena_get_unmapped_area(struct file *filp, unsigned long adreturn -EINVAL ; } - ret =mm_get_unmapped_area (current->mm, filp, addr, len *2 ,0 , flags); + ret =current_get_unmapped_area (filp, addr, len *2 ,0 , flags);if (IS_ERR_VALUE (ret))return ret;if ((ret >>32 ) == ((ret + len -1 ) >>32 ))kernel/bpf/syscall.c +1
-1@@ -992,7 +992,7 @@ static unsigned long bpf_get_unmapped_area(struct file *filp, unsigned long addrif (map->ops->map_get_unmapped_area)return map->ops->map_get_unmapped_area (filp, addr, len, pgoff, flags);#ifdef CONFIG_MMU -return mm_get_unmapped_area (current->mm, filp, addr, len, pgoff, flags); +return current_get_unmapped_area (filp, addr, len, pgoff, flags);#else return addr;#endif mm/mmap.c +5
-6@@ -1901,16 +1901,15 @@ __get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,return error ? error : addr; } -unsigned long -mm_get_unmapped_area (struct mm_struct *mm,struct file *file, -unsigned long addr,unsigned long len, -unsigned long pgoff,unsigned long flags) +unsigned long current_get_unmapped_area (struct file *file,unsigned long addr, +unsigned long len,unsigned long pgoff, +unsigned long flags) { -if (test_bit (MMF_TOPDOWN , &mm->flags)) +if (test_bit (MMF_TOPDOWN , ¤t->mm->flags))return arch_get_unmapped_area_topdown (file, addr, len, pgoff, flags);return arch_get_unmapped_area (file, addr, len, pgoff, flags); } -EXPORT_SYMBOL (mm_get_unmapped_area); +EXPORT_SYMBOL (current_get_unmapped_area);/** * find_vma_intersection() - Look up the first VMA which intersects the interval mm/shmem.c +4
-5@@ -2276,8 +2276,7 @@ unsigned long shmem_get_unmapped_area(struct file *file,if (len >TASK_SIZE )return -ENOMEM ; - addr =mm_get_unmapped_area (current->mm, file, uaddr, len, pgoff, - flags); + addr =current_get_unmapped_area (file, uaddr, len, pgoff, flags);if (!IS_ENABLED (CONFIG_TRANSPARENT_HUGEPAGE ))return addr;@@ -2334,8 +2333,8 @@ unsigned long shmem_get_unmapped_area(struct file *file,if (inflated_len < len)return addr; - inflated_addr =mm_get_unmapped_area (current->mm,NULL , uaddr, - inflated_len,0 , flags); + inflated_addr =current_get_unmapped_area (NULL , uaddr, + inflated_len,0 , flags);if (IS_ERR_VALUE (inflated_addr))return addr;if (inflated_addr & ~PAGE_MASK )@@ -4799,7 +4798,7 @@ unsigned long shmem_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) { - return mm_get_unmapped_area(current->mm, file, addr, len, pgoff, flags); + return current_get_unmapped_area(file, addr, len, pgoff, flags); }#endif
Quoted 1 line
base-commit:
9221b2819b8a4196eecf5476d66201be60fbcf29
BR, Jarkko