diff options
-rw-r--r-- | include/linux/mm.h | 5 | ||||
-rw-r--r-- | mm/memory.c | 8 |
2 files changed, 9 insertions, 4 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index 42a3552f641a..a576467cd4a5 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1241,6 +1241,11 @@ int get_cmdline(struct task_struct *task, char *buffer, int buflen); int vma_is_stack_for_task(struct vm_area_struct *vma, struct task_struct *t); +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 62c2c8a148b0..1de5302d5738 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3105,12 +3105,12 @@ static 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_fault(mm, vma, address, pte, pmd, flags, entry); - - return do_anonymous_page(mm, vma, address, - pte, pmd, flags); } return do_swap_page(mm, vma, address, pte, pmd, flags, entry); |