Skip to content

Commit

Permalink
mmap: remove unnecessary code
Browse files Browse the repository at this point in the history
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]>
Acked-by: Hugh Dickins <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
zyzii authored and torvalds committed Sep 22, 2009
1 parent 03f6462 commit cdf7b34
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -963,11 +963,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) {
Expand Down

0 comments on commit cdf7b34

Please sign in to comment.