diff options
Diffstat (limited to 'mm/memory.c')
-rw-r--r-- | mm/memory.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/mm/memory.c b/mm/memory.c index 81d7117aa58b..e046b7e4b530 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -949,6 +949,8 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, | |||
949 | 949 | ||
950 | cond_resched_lock(&mm->page_table_lock); | 950 | cond_resched_lock(&mm->page_table_lock); |
951 | while (!(page = follow_page(mm, start, write_access))) { | 951 | while (!(page = follow_page(mm, start, write_access))) { |
952 | int ret; | ||
953 | |||
952 | /* | 954 | /* |
953 | * Shortcut for anonymous pages. We don't want | 955 | * Shortcut for anonymous pages. We don't want |
954 | * to force the creation of pages tables for | 956 | * to force the creation of pages tables for |
@@ -961,16 +963,18 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, | |||
961 | break; | 963 | break; |
962 | } | 964 | } |
963 | spin_unlock(&mm->page_table_lock); | 965 | spin_unlock(&mm->page_table_lock); |
964 | switch (__handle_mm_fault(mm, vma, start, | 966 | ret = __handle_mm_fault(mm, vma, start, write_access); |
965 | write_access)) { | 967 | |
966 | case VM_FAULT_WRITE: | 968 | /* |
967 | /* | 969 | * The VM_FAULT_WRITE bit tells us that do_wp_page has |
968 | * do_wp_page has broken COW when | 970 | * broken COW when necessary, even if maybe_mkwrite |
969 | * necessary, even if maybe_mkwrite | 971 | * decided not to set pte_write. We can thus safely do |
970 | * decided not to set pte_write | 972 | * subsequent page lookups as if they were reads. |
971 | */ | 973 | */ |
974 | if (ret & VM_FAULT_WRITE) | ||
972 | write_access = 0; | 975 | write_access = 0; |
973 | /* FALLTHRU */ | 976 | |
977 | switch (ret & ~VM_FAULT_WRITE) { | ||
974 | case VM_FAULT_MINOR: | 978 | case VM_FAULT_MINOR: |
975 | tsk->min_flt++; | 979 | tsk->min_flt++; |
976 | break; | 980 | break; |