aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/memory.c')
-rw-r--r--mm/memory.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/mm/memory.c b/mm/memory.c
index 98bcb90d5957..65216194eb8d 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1207,8 +1207,8 @@ static inline int use_zero_page(struct vm_area_struct *vma)
1207 1207
1208 1208
1209int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, 1209int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
1210 unsigned long start, int len, int flags, 1210 unsigned long start, int nr_pages, int flags,
1211 struct page **pages, struct vm_area_struct **vmas) 1211 struct page **pages, struct vm_area_struct **vmas)
1212{ 1212{
1213 int i; 1213 int i;
1214 unsigned int vm_flags = 0; 1214 unsigned int vm_flags = 0;
@@ -1217,7 +1217,7 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
1217 int ignore = !!(flags & GUP_FLAGS_IGNORE_VMA_PERMISSIONS); 1217 int ignore = !!(flags & GUP_FLAGS_IGNORE_VMA_PERMISSIONS);
1218 int ignore_sigkill = !!(flags & GUP_FLAGS_IGNORE_SIGKILL); 1218 int ignore_sigkill = !!(flags & GUP_FLAGS_IGNORE_SIGKILL);
1219 1219
1220 if (len <= 0) 1220 if (nr_pages <= 0)
1221 return 0; 1221 return 0;
1222 /* 1222 /*
1223 * Require read or write permissions. 1223 * Require read or write permissions.
@@ -1269,7 +1269,7 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
1269 vmas[i] = gate_vma; 1269 vmas[i] = gate_vma;
1270 i++; 1270 i++;
1271 start += PAGE_SIZE; 1271 start += PAGE_SIZE;
1272 len--; 1272 nr_pages--;
1273 continue; 1273 continue;
1274 } 1274 }
1275 1275
@@ -1280,7 +1280,7 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
1280 1280
1281 if (is_vm_hugetlb_page(vma)) { 1281 if (is_vm_hugetlb_page(vma)) {
1282 i = follow_hugetlb_page(mm, vma, pages, vmas, 1282 i = follow_hugetlb_page(mm, vma, pages, vmas,
1283 &start, &len, i, write); 1283 &start, &nr_pages, i, write);
1284 continue; 1284 continue;
1285 } 1285 }
1286 1286
@@ -1311,8 +1311,10 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
1311 while (!(page = follow_page(vma, start, foll_flags))) { 1311 while (!(page = follow_page(vma, start, foll_flags))) {
1312 int ret; 1312 int ret;
1313 1313
1314 /* FOLL_WRITE matches FAULT_FLAG_WRITE! */ 1314 ret = handle_mm_fault(mm, vma, start,
1315 ret = handle_mm_fault(mm, vma, start, foll_flags & FOLL_WRITE); 1315 (foll_flags & FOLL_WRITE) ?
1316 FAULT_FLAG_WRITE : 0);
1317
1316 if (ret & VM_FAULT_ERROR) { 1318 if (ret & VM_FAULT_ERROR) {
1317 if (ret & VM_FAULT_OOM) 1319 if (ret & VM_FAULT_OOM)
1318 return i ? i : -ENOMEM; 1320 return i ? i : -ENOMEM;
@@ -1355,9 +1357,9 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
1355 vmas[i] = vma; 1357 vmas[i] = vma;
1356 i++; 1358 i++;
1357 start += PAGE_SIZE; 1359 start += PAGE_SIZE;
1358 len--; 1360 nr_pages--;
1359 } while (len && start < vma->vm_end); 1361 } while (nr_pages && start < vma->vm_end);
1360 } while (len); 1362 } while (nr_pages);
1361 return i; 1363 return i;
1362} 1364}
1363 1365
@@ -1366,7 +1368,7 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
1366 * @tsk: task_struct of target task 1368 * @tsk: task_struct of target task
1367 * @mm: mm_struct of target mm 1369 * @mm: mm_struct of target mm
1368 * @start: starting user address 1370 * @start: starting user address
1369 * @len: number of pages from start to pin 1371 * @nr_pages: number of pages from start to pin
1370 * @write: whether pages will be written to by the caller 1372 * @write: whether pages will be written to by the caller
1371 * @force: whether to force write access even if user mapping is 1373 * @force: whether to force write access even if user mapping is
1372 * readonly. This will result in the page being COWed even 1374 * readonly. This will result in the page being COWed even
@@ -1378,7 +1380,7 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
1378 * Or NULL if the caller does not require them. 1380 * Or NULL if the caller does not require them.
1379 * 1381 *
1380 * Returns number of pages pinned. This may be fewer than the number 1382 * Returns number of pages pinned. This may be fewer than the number
1381 * requested. If len is 0 or negative, returns 0. If no pages 1383 * requested. If nr_pages is 0 or negative, returns 0. If no pages
1382 * were pinned, returns -errno. Each page returned must be released 1384 * were pinned, returns -errno. Each page returned must be released
1383 * with a put_page() call when it is finished with. vmas will only 1385 * with a put_page() call when it is finished with. vmas will only
1384 * remain valid while mmap_sem is held. 1386 * remain valid while mmap_sem is held.
@@ -1412,7 +1414,7 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
1412 * See also get_user_pages_fast, for performance critical applications. 1414 * See also get_user_pages_fast, for performance critical applications.
1413 */ 1415 */
1414int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, 1416int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
1415 unsigned long start, int len, int write, int force, 1417 unsigned long start, int nr_pages, int write, int force,
1416 struct page **pages, struct vm_area_struct **vmas) 1418 struct page **pages, struct vm_area_struct **vmas)
1417{ 1419{
1418 int flags = 0; 1420 int flags = 0;
@@ -1422,9 +1424,7 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
1422 if (force) 1424 if (force)
1423 flags |= GUP_FLAGS_FORCE; 1425 flags |= GUP_FLAGS_FORCE;
1424 1426
1425 return __get_user_pages(tsk, mm, 1427 return __get_user_pages(tsk, mm, start, nr_pages, flags, pages, vmas);
1426 start, len, flags,
1427 pages, vmas);
1428} 1428}
1429 1429
1430EXPORT_SYMBOL(get_user_pages); 1430EXPORT_SYMBOL(get_user_pages);
@@ -2517,7 +2517,7 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma,
2517 delayacct_set_flag(DELAYACCT_PF_SWAPIN); 2517 delayacct_set_flag(DELAYACCT_PF_SWAPIN);
2518 page = lookup_swap_cache(entry); 2518 page = lookup_swap_cache(entry);
2519 if (!page) { 2519 if (!page) {
2520 grab_swap_token(); /* Contend for token _before_ read-in */ 2520 grab_swap_token(mm); /* Contend for token _before_ read-in */
2521 page = swapin_readahead(entry, 2521 page = swapin_readahead(entry,
2522 GFP_HIGHUSER_MOVABLE, vma, address); 2522 GFP_HIGHUSER_MOVABLE, vma, address);
2523 if (!page) { 2523 if (!page) {