Skip to contentSkip to conversation

mmap : remove unnecessary code

PATCH In review Huang Shijie 2 participants 2 messages Sep 8, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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.

---
 mm/mmap.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
mm/mmap.c +1 -3
index 8101de4..6b240ce 100644
@@ -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>
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Huang Shijie

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.

Quoted 12 lines
---
 mm/mmap.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
mm/mmap.c +0 -0
index 8101de4..6b240ce 100644
@@ -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>