aboutsummaryrefslogtreecommitdiffstats
path: root/mm/gup.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-08-07 00:14:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-07 00:14:42 -0400
commit33caee39925b887a99a2400dc5c980097c3573f9 (patch)
tree8e68ad97e1fee88c4a3f31453041f8d139f2027e /mm/gup.c
parent6456a0438b984186a0c9c8ecc9fe3d97b7ac3613 (diff)
parentf84223087402c45179be5e7060c5736c17a7b271 (diff)
Merge branch 'akpm' (patchbomb from Andrew Morton)
Merge incoming from Andrew Morton: - Various misc things. - arch/sh updates. - Part of ocfs2. Review is slow. - Slab updates. - Most of -mm. - printk updates. - lib/ updates. - checkpatch updates. * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (226 commits) checkpatch: update $declaration_macros, add uninitialized_var checkpatch: warn on missing spaces in broken up quoted checkpatch: fix false positives for --strict "space after cast" test checkpatch: fix false positive MISSING_BREAK warnings with --file checkpatch: add test for native c90 types in unusual order checkpatch: add signed generic types checkpatch: add short int to c variable types checkpatch: add for_each tests to indentation and brace tests checkpatch: fix brace style misuses of else and while checkpatch: add --fix option for a couple OPEN_BRACE misuses checkpatch: use the correct indentation for which() checkpatch: add fix_insert_line and fix_delete_line helpers checkpatch: add ability to insert and delete lines to patch/file checkpatch: add an index variable for fixed lines checkpatch: warn on break after goto or return with same tab indentation checkpatch: emit a warning on file add/move/delete checkpatch: add test for commit id formatting style in commit log checkpatch: emit fewer kmalloc_array/kcalloc conversion warnings checkpatch: improve "no space after cast" test checkpatch: allow multiple const * types ...
Diffstat (limited to 'mm/gup.c')
-rw-r--r--mm/gup.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/mm/gup.c b/mm/gup.c
index cc5a9e7adea7..91d044b1600d 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -258,6 +258,11 @@ unmap:
258 return ret; 258 return ret;
259} 259}
260 260
261/*
262 * mmap_sem must be held on entry. If @nonblocking != NULL and
263 * *@flags does not include FOLL_NOWAIT, the mmap_sem may be released.
264 * If it is, *@nonblocking will be set to 0 and -EBUSY returned.
265 */
261static int faultin_page(struct task_struct *tsk, struct vm_area_struct *vma, 266static int faultin_page(struct task_struct *tsk, struct vm_area_struct *vma,
262 unsigned long address, unsigned int *flags, int *nonblocking) 267 unsigned long address, unsigned int *flags, int *nonblocking)
263{ 268{
@@ -373,7 +378,7 @@ static int check_vma_flags(struct vm_area_struct *vma, unsigned long gup_flags)
373 * with a put_page() call when it is finished with. vmas will only 378 * with a put_page() call when it is finished with. vmas will only
374 * remain valid while mmap_sem is held. 379 * remain valid while mmap_sem is held.
375 * 380 *
376 * Must be called with mmap_sem held for read or write. 381 * Must be called with mmap_sem held. It may be released. See below.
377 * 382 *
378 * __get_user_pages walks a process's page tables and takes a reference to 383 * __get_user_pages walks a process's page tables and takes a reference to
379 * each struct page that each user address corresponds to at a given 384 * each struct page that each user address corresponds to at a given
@@ -396,7 +401,14 @@ static int check_vma_flags(struct vm_area_struct *vma, unsigned long gup_flags)
396 * 401 *
397 * If @nonblocking != NULL, __get_user_pages will not wait for disk IO 402 * If @nonblocking != NULL, __get_user_pages will not wait for disk IO
398 * or mmap_sem contention, and if waiting is needed to pin all pages, 403 * or mmap_sem contention, and if waiting is needed to pin all pages,
399 * *@nonblocking will be set to 0. 404 * *@nonblocking will be set to 0. Further, if @gup_flags does not
405 * include FOLL_NOWAIT, the mmap_sem will be released via up_read() in
406 * this case.
407 *
408 * A caller using such a combination of @nonblocking and @gup_flags
409 * must therefore hold the mmap_sem for reading only, and recognize
410 * when it's been released. Otherwise, it must be held for either
411 * reading or writing and will not be released.
400 * 412 *
401 * In most cases, get_user_pages or get_user_pages_fast should be used 413 * In most cases, get_user_pages or get_user_pages_fast should be used
402 * instead of __get_user_pages. __get_user_pages should be used only if 414 * instead of __get_user_pages. __get_user_pages should be used only if
@@ -528,7 +540,7 @@ EXPORT_SYMBOL(__get_user_pages);
528 * such architectures, gup() will not be enough to make a subsequent access 540 * such architectures, gup() will not be enough to make a subsequent access
529 * succeed. 541 * succeed.
530 * 542 *
531 * This should be called with the mm_sem held for read. 543 * This has the same semantics wrt the @mm->mmap_sem as does filemap_fault().
532 */ 544 */
533int fixup_user_fault(struct task_struct *tsk, struct mm_struct *mm, 545int fixup_user_fault(struct task_struct *tsk, struct mm_struct *mm,
534 unsigned long address, unsigned int fault_flags) 546 unsigned long address, unsigned int fault_flags)