All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmap : remove unnecessary code
@ 2009-09-08  2:38 Huang Shijie
  2009-09-08 18:13 ` Hugh Dickins
  0 siblings, 1 reply; 2+ messages in thread
From: Huang Shijie @ 2009-09-08  2:38 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, 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.

Signed-off-by: Huang Shijie <shijie8@gmail.com>
---
 mm/mmap.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 8101de4..6b240ce 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -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) {
-- 
1.6.0.6

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mmap : remove unnecessary code
  2009-09-08  2:38 [PATCH] mmap : remove unnecessary code Huang Shijie
@ 2009-09-08 18:13 ` Hugh Dickins
  0 siblings, 0 replies; 2+ messages in thread
From: Hugh Dickins @ 2009-09-08 18:13 UTC (permalink / raw)
  To: Huang Shijie; +Cc: akpm, linux-mm

On Tue, 8 Sep 2009, Huang Shijie wrote:

> 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 <shijie8@gmail.com>

Acked-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>

> ---
>  mm/mmap.c |    4 +---
>  1 files changed, 1 insertions(+), 3 deletions(-)
> 
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 8101de4..6b240ce 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -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) {
> -- 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-09-08 18:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-08  2:38 [PATCH] mmap : remove unnecessary code Huang Shijie
2009-09-08 18:13 ` Hugh Dickins

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.