mmap : remove unnecessary code
Subsystems (2)
PATCH 1/1 mmap : remove unnecessary code
If (flags & MAP_LOCKED) is true, it means vm_flags has already contained the bit VM_LOCKED which is set by calc_vm_flag_bits().
So there is no need to reset it again, just remove it.
Signed-off-by Huang Shijie <[email protected]>
--- mm/mmap.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
mm/mmap.c +1 -3
@@ -965,11 +965,9 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, vm_flags =calc_vm_prot_bits (prot) |calc_vm_flag_bits (flags) | mm->def_flags |VM_MAYREAD |VM_MAYWRITE |VM_MAYEXEC ; -if (flags &MAP_LOCKED ) { +if (flags &MAP_LOCKED )if (!can_do_mlock ())return -EPERM ; - vm_flags |=VM_LOCKED ; - }/* mlock MCL_FUTURE? */ if (vm_flags &VM_LOCKED ) {
Signature · 7 lines
1.6.0.6 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 6 lines · Huang Shijie
If (flags &
MAP_LOCKED) is true, it meansvm_flagshas already contained the bitVM_LOCKEDwhich is set bycalc_vm_flag_bits().So there is no need to reset it again, just remove it.
Signed-off-by Huang Shijie <[email protected]>
Acked-by Hugh Dickins <[email protected]>
Quoted 12 lines
--- mm/mmap.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)mm/mmap.c +0
-0@@ -965,11 +965,9 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, vm_flags =calc_vm_prot_bits (prot) |calc_vm_flag_bits (flags) | mm->def_flags |VM_MAYREAD |VM_MAYWRITE |VM_MAYEXEC ;
mm/mmap.c unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, · line 973
Quoted 10 lines
mm/mmap.c +1
-3-if (flags &MAP_LOCKED ) { +if (flags &MAP_LOCKED )if (!can_do_mlock ())return -EPERM ; - vm_flags |=VM_LOCKED ; - }/* mlock MCL_FUTURE? */ if (vm_flags &VM_LOCKED ) {
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>