From: Kirill A. Shutemov Date: Wed, 9 Sep 2015 22:39:35 +0000 (-0700) Subject: mm: use vma_is_anonymous() in create_huge_pmd() and wp_huge_pmd() X-Git-Tag: v4.3-rc1~22^2~5 X-Git-Url: https://git.kernelconcepts.de/?p=karo-tx-linux.git;a=commitdiff_plain;h=fb6dd5fa4165c4b82f1a11416c2fc192ae3a84e2 mm: use vma_is_anonymous() in create_huge_pmd() and wp_huge_pmd() Let's use helper rather than direct check of vma->vm_ops to distinguish anonymous VMA. Signed-off-by: Kirill A. Shutemov Reviewed-by: Oleg Nesterov Cc: "H. Peter Anvin" Cc: Andy Lutomirski Cc: Dave Hansen Cc: Ingo Molnar Cc: Minchan Kim Cc: Thomas Gleixner Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/memory.c b/mm/memory.c index 6cd0b2160401..9cb27470fee9 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3233,7 +3233,7 @@ out: static int create_huge_pmd(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, pmd_t *pmd, unsigned int flags) { - if (!vma->vm_ops) + if (vma_is_anonymous(vma)) return do_huge_pmd_anonymous_page(mm, vma, address, pmd, flags); if (vma->vm_ops->pmd_fault) return vma->vm_ops->pmd_fault(vma, address, pmd, flags); @@ -3244,7 +3244,7 @@ static int wp_huge_pmd(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, pmd_t *pmd, pmd_t orig_pmd, unsigned int flags) { - if (!vma->vm_ops) + if (vma_is_anonymous(vma)) return do_huge_pmd_wp_page(mm, vma, address, pmd, orig_pmd); if (vma->vm_ops->pmd_fault) return vma->vm_ops->pmd_fault(vma, address, pmd, flags);