From: Christoph Lameter <cl@linux-foundation.org>
To: Brice Goglin <Brice.Goglin@inria.fr>
Cc: Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC/PATCH] No get_user/put_user while holding mmap_sem in do_pages_stat?
Date: Tue, 9 Dec 2008 08:19:31 -0600 (CST) [thread overview]
Message-ID: <Pine.LNX.4.64.0812090811450.13181@quilx.com> (raw)
In-Reply-To: <493BDBE6.9040600@inria.fr>
I guess the simplest solution would be to move the taking of mmap_sem into
the loop. Mean taking mmap_sem for every page that we determine the status of.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Index: linux-2.6/mm/migrate.c
===================================================================
--- linux-2.6.orig/mm/migrate.c 2008-12-09 08:07:08.796603952 -0600
+++ linux-2.6/mm/migrate.c 2008-12-09 08:08:36.400116263 -0600
@@ -994,8 +994,6 @@
unsigned long i;
int err;
- down_read(&mm->mmap_sem);
-
for (i = 0; i < nr_pages; i++) {
const void __user *p;
unsigned long addr;
@@ -1007,12 +1005,17 @@
goto out;
addr = (unsigned long) p;
+ down_read(&mm->mmap_sem);
+
vma = find_vma(mm, addr);
- if (!vma)
+ if (!vma) {
+ up_read(&mm->mmap_sem);
goto set_status;
-
+ }
page = follow_page(vma, addr, 0);
+ up_read(&mm->mmap_sem);
+
err = PTR_ERR(page);
if (IS_ERR(page))
goto set_status;
@@ -1029,7 +1032,6 @@
err = 0;
out:
- up_read(&mm->mmap_sem);
return err;
}
next prev parent reply other threads:[~2008-12-09 14:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-07 2:14 Brice Goglin
2008-12-07 2:50 ` Andrew Morton
2008-12-07 14:21 ` Brice Goglin
2008-12-09 14:19 ` Christoph Lameter [this message]
2008-12-09 16:35 ` Peter Zijlstra
2008-12-09 16:47 ` Brice Goglin
2008-12-09 17:46 ` Peter Zijlstra
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.0812090811450.13181@quilx.com \
--to=cl@linux-foundation.org \
--cc=Brice.Goglin@inria.fr \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®