linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] madvise_need_mmap_write() usage
@ 2007-06-15 15:20 Jason Baron
  2007-06-16 19:41 ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Jason Baron @ 2007-06-15 15:20 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-mm, nickpiggin, Rik van Riel

hi,

i was just looking at the new madvise_need_mmap_write() call...can we
avoid an extra case statement and function call as follows?

thanks,

-Jason


Signed-off-by: Jason Baron <jbaron@redhat.com>

diff --git a/mm/madvise.c b/mm/madvise.c
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -287,9 +287,10 @@ asmlinkage long sys_madvise(unsigned long start, size_t len_in, int behavior)
 	struct vm_area_struct * vma, *prev;
 	int unmapped_error = 0;
 	int error = -EINVAL;
+	int write;
 	size_t len;
 
-	if (madvise_need_mmap_write(behavior))
+	if (write = madvise_need_mmap_write(behavior))
 		down_write(&current->mm->mmap_sem);
 	else
 		down_read(&current->mm->mmap_sem);
@@ -354,7 +355,7 @@ asmlinkage long sys_madvise(unsigned long start, size_t len_in, int behavior)
 			vma = find_vma(current->mm, start);
 	}
 out:
-	if (madvise_need_mmap_write(behavior))
+	if (write)
 		up_write(&current->mm->mmap_sem);
 	else
 		up_read(&current->mm->mmap_sem);

--
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] 4+ messages in thread

end of thread, other threads:[~2007-06-18 16:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-15 15:20 [PATCH] madvise_need_mmap_write() usage Jason Baron
2007-06-16 19:41 ` Christoph Hellwig
2007-06-18 15:35   ` Jason Baron
2007-06-18 16:51     ` Nish Aravamudan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox