aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/mm/gup.c8
-rw-r--r--arch/s390/mm/gup.c6
-rw-r--r--arch/sh/mm/gup.c6
-rw-r--r--arch/sparc/mm/gup.c6
-rw-r--r--arch/x86/mm/gup.c7
-rw-r--r--mm/gup.c6
-rw-r--r--mm/util.c10
7 files changed, 16 insertions, 33 deletions
diff --git a/arch/mips/mm/gup.c b/arch/mips/mm/gup.c
index 70795a67a276..349995d19c7f 100644
--- a/arch/mips/mm/gup.c
+++ b/arch/mips/mm/gup.c
@@ -301,11 +301,9 @@ slow_irqon:
301 start += nr << PAGE_SHIFT; 301 start += nr << PAGE_SHIFT;
302 pages += nr; 302 pages += nr;
303 303
304 down_read(&mm->mmap_sem); 304 ret = get_user_pages_unlocked(current, mm, start,
305 ret = get_user_pages(current, mm, start, 305 (end - start) >> PAGE_SHIFT,
306 (end - start) >> PAGE_SHIFT, 306 write, 0, pages);
307 write, 0, pages, NULL);
308 up_read(&mm->mmap_sem);
309 307
310 /* Have to be a bit careful with return values */ 308 /* Have to be a bit careful with return values */
311 if (nr > 0) { 309 if (nr > 0) {
diff --git a/arch/s390/mm/gup.c b/arch/s390/mm/gup.c
index 639fce464008..5c586c78ca8d 100644
--- a/arch/s390/mm/gup.c
+++ b/arch/s390/mm/gup.c
@@ -235,10 +235,8 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
235 /* Try to get the remaining pages with get_user_pages */ 235 /* Try to get the remaining pages with get_user_pages */
236 start += nr << PAGE_SHIFT; 236 start += nr << PAGE_SHIFT;
237 pages += nr; 237 pages += nr;
238 down_read(&mm->mmap_sem); 238 ret = get_user_pages_unlocked(current, mm, start,
239 ret = get_user_pages(current, mm, start, 239 nr_pages - nr, write, 0, pages);
240 nr_pages - nr, write, 0, pages, NULL);
241 up_read(&mm->mmap_sem);
242 /* Have to be a bit careful with return values */ 240 /* Have to be a bit careful with return values */
243 if (nr > 0) 241 if (nr > 0)
244 ret = (ret < 0) ? nr : ret + nr; 242 ret = (ret < 0) ? nr : ret + nr;
diff --git a/arch/sh/mm/gup.c b/arch/sh/mm/gup.c
index 37458f38b220..e15f52a17b6c 100644
--- a/arch/sh/mm/gup.c
+++ b/arch/sh/mm/gup.c
@@ -257,10 +257,8 @@ slow_irqon:
257 start += nr << PAGE_SHIFT; 257 start += nr << PAGE_SHIFT;
258 pages += nr; 258 pages += nr;
259 259
260 down_read(&mm->mmap_sem); 260 ret = get_user_pages_unlocked(current, mm, start,
261 ret = get_user_pages(current, mm, start, 261 (end - start) >> PAGE_SHIFT, write, 0, pages);
262 (end - start) >> PAGE_SHIFT, write, 0, pages, NULL);
263 up_read(&mm->mmap_sem);
264 262
265 /* Have to be a bit careful with return values */ 263 /* Have to be a bit careful with return values */
266 if (nr > 0) { 264 if (nr > 0) {
diff --git a/arch/sparc/mm/gup.c b/arch/sparc/mm/gup.c
index ae6ce383d4df..2e5c4fc2daa9 100644
--- a/arch/sparc/mm/gup.c
+++ b/arch/sparc/mm/gup.c
@@ -249,10 +249,8 @@ slow:
249 start += nr << PAGE_SHIFT; 249 start += nr << PAGE_SHIFT;
250 pages += nr; 250 pages += nr;
251 251
252 down_read(&mm->mmap_sem); 252 ret = get_user_pages_unlocked(current, mm, start,
253 ret = get_user_pages(current, mm, start, 253 (end - start) >> PAGE_SHIFT, write, 0, pages);
254 (end - start) >> PAGE_SHIFT, write, 0, pages, NULL);
255 up_read(&mm->mmap_sem);
256 254
257 /* Have to be a bit careful with return values */ 255 /* Have to be a bit careful with return values */
258 if (nr > 0) { 256 if (nr > 0) {
diff --git a/arch/x86/mm/gup.c b/arch/x86/mm/gup.c
index 224b14235e96..89df70e0caa6 100644
--- a/arch/x86/mm/gup.c
+++ b/arch/x86/mm/gup.c
@@ -388,10 +388,9 @@ slow_irqon:
388 start += nr << PAGE_SHIFT; 388 start += nr << PAGE_SHIFT;
389 pages += nr; 389 pages += nr;
390 390
391 down_read(&mm->mmap_sem); 391 ret = get_user_pages_unlocked(current, mm, start,
392 ret = get_user_pages(current, mm, start, 392 (end - start) >> PAGE_SHIFT,
393 (end - start) >> PAGE_SHIFT, write, 0, pages, NULL); 393 write, 0, pages);
394 up_read(&mm->mmap_sem);
395 394
396 /* Have to be a bit careful with return values */ 395 /* Have to be a bit careful with return values */
397 if (nr > 0) { 396 if (nr > 0) {
diff --git a/mm/gup.c b/mm/gup.c
index dad5875fb766..c2da1163986a 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -1243,10 +1243,8 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
1243 start += nr << PAGE_SHIFT; 1243 start += nr << PAGE_SHIFT;
1244 pages += nr; 1244 pages += nr;
1245 1245
1246 down_read(&mm->mmap_sem); 1246 ret = get_user_pages_unlocked(current, mm, start,
1247 ret = get_user_pages(current, mm, start, 1247 nr_pages - nr, write, 0, pages);
1248 nr_pages - nr, write, 0, pages, NULL);
1249 up_read(&mm->mmap_sem);
1250 1248
1251 /* Have to be a bit careful with return values */ 1249 /* Have to be a bit careful with return values */
1252 if (nr > 0) { 1250 if (nr > 0) {
diff --git a/mm/util.c b/mm/util.c
index fec39d4509a9..f3ef639c4857 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -240,14 +240,8 @@ int __weak get_user_pages_fast(unsigned long start,
240 int nr_pages, int write, struct page **pages) 240 int nr_pages, int write, struct page **pages)
241{ 241{
242 struct mm_struct *mm = current->mm; 242 struct mm_struct *mm = current->mm;
243 int ret; 243 return get_user_pages_unlocked(current, mm, start, nr_pages,
244 244 write, 0, pages);
245 down_read(&mm->mmap_sem);
246 ret = get_user_pages(current, mm, start, nr_pages,
247 write, 0, pages, NULL);
248 up_read(&mm->mmap_sem);
249
250 return ret;
251} 245}
252EXPORT_SYMBOL_GPL(get_user_pages_fast); 246EXPORT_SYMBOL_GPL(get_user_pages_fast);
253 247