diff mbox series

[V2,4/4] mm/vma: Replace all remaining open encodings with vma_is_anonymous()

Message ID 1582520593-30704-5-git-send-email-anshuman.khandual@arm.com (mailing list archive)
State New, archived
Headers show
Series mm/vma: Use all available wrappers when possible | expand

Commit Message

Anshuman Khandual Feb. 24, 2020, 5:03 a.m. UTC
This replaces all remaining open encodings with vma_is_anonymous().

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 mm/gup.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Vlastimil Babka Feb. 26, 2020, 5:42 p.m. UTC | #1
On 2/24/20 6:03 AM, Anshuman Khandual wrote:
> This replaces all remaining open encodings with vma_is_anonymous().
> 
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>

Acked-by: Vlastimil Babka <vbabka@suse.cz

> ---
>  mm/gup.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/gup.c b/mm/gup.c
> index c8ffe2e61f03..58c8cbfeded6 100644
> --- a/mm/gup.c
> +++ b/mm/gup.c
> @@ -146,7 +146,8 @@ static struct page *no_page_table(struct vm_area_struct *vma,
>  	 * But we can only make this optimization where a hole would surely
>  	 * be zero-filled if handle_mm_fault() actually did handle it.
>  	 */
> -	if ((flags & FOLL_DUMP) && (!vma->vm_ops || !vma->vm_ops->fault))
> +	if ((flags & FOLL_DUMP) &&
> +			(vma_is_anonymous(vma) || !vma->vm_ops->fault))
>  		return ERR_PTR(-EFAULT);
>  	return NULL;
>  }
>
diff mbox series

Patch

diff --git a/mm/gup.c b/mm/gup.c
index c8ffe2e61f03..58c8cbfeded6 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -146,7 +146,8 @@  static struct page *no_page_table(struct vm_area_struct *vma,
 	 * But we can only make this optimization where a hole would surely
 	 * be zero-filled if handle_mm_fault() actually did handle it.
 	 */
-	if ((flags & FOLL_DUMP) && (!vma->vm_ops || !vma->vm_ops->fault))
+	if ((flags & FOLL_DUMP) &&
+			(vma_is_anonymous(vma) || !vma->vm_ops->fault))
 		return ERR_PTR(-EFAULT);
 	return NULL;
 }