From: Jason Baron <jbaron@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org, nickpiggin@yahoo.com.au,
Rik van Riel <riel@redhat.com>
Subject: [PATCH] madvise_need_mmap_write() usage
Date: Fri, 15 Jun 2007 11:20:31 -0400 (EDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0706151118150.11498@dhcp83-20.boston.redhat.com> (raw)
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(¤t->mm->mmap_sem);
else
down_read(¤t->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(¤t->mm->mmap_sem);
else
up_read(¤t->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>
next reply other threads:[~2007-06-15 15:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-15 15:20 Jason Baron [this message]
2007-06-16 19:41 ` Christoph Hellwig
2007-06-18 15:35 ` Jason Baron
2007-06-18 16:51 ` Nish Aravamudan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0706151118150.11498@dhcp83-20.boston.redhat.com \
--to=jbaron@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nickpiggin@yahoo.com.au \
--cc=riel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox