aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/linux/mm.h5
-rw-r--r--mm/memory.c7
2 files changed, 9 insertions, 3 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index c1fab7973..740a1f7d3 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1120,6 +1120,11 @@ int clear_page_dirty_for_io(struct page *page);
extern struct task_struct *task_of_stack(struct task_struct *task,
struct vm_area_struct *vma, bool in_group);
+static inline bool vma_is_anonymous(struct vm_area_struct *vma)
+{
+ return !vma->vm_ops;
+}
+
extern unsigned long move_page_tables(struct vm_area_struct *vma,
unsigned long old_addr, struct vm_area_struct *new_vma,
unsigned long new_addr, unsigned long len,
diff --git a/mm/memory.c b/mm/memory.c
index 12d825704..e3255d0be 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3710,11 +3710,12 @@ int handle_pte_fault(struct mm_struct *mm,
entry = *pte;
if (!pte_present(entry)) {
if (pte_none(entry)) {
- if (vma->vm_ops)
+ if (vma_is_anonymous(vma))
+ return do_anonymous_page(mm, vma, address,
+ pte, pmd, flags);
+ else
return do_linear_fault(mm, vma, address,
pte, pmd, flags, entry);
- return do_anonymous_page(mm, vma, address,
- pte, pmd, flags);
}
if (pte_file(entry))
return do_nonlinear_fault(mm, vma, address,