mm: use vma_is_anonymous() in create_huge_pmd() and wp_huge_pmd()
authorKirill A. Shutemov <[email protected]>
Wed, 9 Sep 2015 22:39:35 +0000 (15:39 -0700)
committerLinus Torvalds <[email protected]>
Thu, 10 Sep 2015 20:29:01 +0000 (13:29 -0700)
Let's use helper rather than direct check of vma->vm_ops to distinguish
anonymous VMA.

Signed-off-by: Kirill A. Shutemov <[email protected]>
Reviewed-by: Oleg Nesterov <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Minchan Kim <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/memory.c

index 6cd0b216040190f74087f61f4d8650f970176438..9cb27470fee991cb874676bb0cbc0f694b5e1d36 100644 (file)
@@ -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);