aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/memory.c')
-rw-r--r--mm/memory.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/mm/memory.c b/mm/memory.c
index 0d14d1e58a5f..46958fb97c2d 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1057,8 +1057,7 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
1057 if (pages) 1057 if (pages)
1058 foll_flags |= FOLL_GET; 1058 foll_flags |= FOLL_GET;
1059 if (!write && !(vma->vm_flags & VM_LOCKED) && 1059 if (!write && !(vma->vm_flags & VM_LOCKED) &&
1060 (!vma->vm_ops || (!vma->vm_ops->nopage && 1060 (!vma->vm_ops || !vma->vm_ops->fault))
1061 !vma->vm_ops->fault)))
1062 foll_flags |= FOLL_ANON; 1061 foll_flags |= FOLL_ANON;
1063 1062
1064 do { 1063 do {
@@ -2199,20 +2198,9 @@ static int __do_fault(struct mm_struct *mm, struct vm_area_struct *vma,
2199 2198
2200 BUG_ON(vma->vm_flags & VM_PFNMAP); 2199 BUG_ON(vma->vm_flags & VM_PFNMAP);
2201 2200
2202 if (likely(vma->vm_ops->fault)) { 2201 ret = vma->vm_ops->fault(vma, &vmf);
2203 ret = vma->vm_ops->fault(vma, &vmf); 2202 if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE)))
2204 if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE))) 2203 return ret;
2205 return ret;
2206 } else {
2207 /* Legacy ->nopage path */
2208 ret = 0;
2209 vmf.page = vma->vm_ops->nopage(vma, address & PAGE_MASK, &ret);
2210 /* no page was available -- either SIGBUS or OOM */
2211 if (unlikely(vmf.page == NOPAGE_SIGBUS))
2212 return VM_FAULT_SIGBUS;
2213 else if (unlikely(vmf.page == NOPAGE_OOM))
2214 return VM_FAULT_OOM;
2215 }
2216 2204
2217 /* 2205 /*
2218 * For consistency in subsequent calls, make the faulted page always 2206 * For consistency in subsequent calls, make the faulted page always
@@ -2458,7 +2446,7 @@ static inline int handle_pte_fault(struct mm_struct *mm,
2458 if (!pte_present(entry)) { 2446 if (!pte_present(entry)) {
2459 if (pte_none(entry)) { 2447 if (pte_none(entry)) {
2460 if (vma->vm_ops) { 2448 if (vma->vm_ops) {
2461 if (vma->vm_ops->fault || vma->vm_ops->nopage) 2449 if (likely(vma->vm_ops->fault))
2462 return do_linear_fault(mm, vma, address, 2450 return do_linear_fault(mm, vma, address,
2463 pte, pmd, write_access, entry); 2451 pte, pmd, write_access, entry);
2464 if (unlikely(vma->vm_ops->nopfn)) 2452 if (unlikely(vma->vm_ops->nopfn))