diff mbox series

gup: Convert FOLL_TOUCH case in follow_page_pte() to folio

Message ID 20241002151403.1345296-1-willy@infradead.org (mailing list archive)
State New
Headers show
Series gup: Convert FOLL_TOUCH case in follow_page_pte() to folio | expand

Commit Message

Matthew Wilcox Oct. 2, 2024, 3:13 p.m. UTC
We already have the folio here, so just use it, removing three hidden
calls to compound_head().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 mm/gup.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

David Hildenbrand Oct. 8, 2024, 2:12 p.m. UTC | #1
On 02.10.24 17:13, Matthew Wilcox (Oracle) wrote:
> We already have the folio here, so just use it, removing three hidden
> calls to compound_head().
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
>   mm/gup.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/gup.c b/mm/gup.c
> index a82890b46a36..7aecaa5ff6f3 100644
> --- a/mm/gup.c
> +++ b/mm/gup.c
> @@ -922,14 +922,14 @@ static struct page *follow_page_pte(struct vm_area_struct *vma,
>   	}
>   	if (flags & FOLL_TOUCH) {
>   		if ((flags & FOLL_WRITE) &&
> -		    !pte_dirty(pte) && !PageDirty(page))
> -			set_page_dirty(page);
> +		    !pte_dirty(pte) && !folio_test_dirty(folio))
> +			folio_mark_dirty(folio);
>   		/*
>   		 * pte_mkyoung() would be more correct here, but atomic care
>   		 * is needed to avoid losing the dirty bit: it is easier to use
> -		 * mark_page_accessed().
> +		 * folio_mark_accessed().
>   		 */
> -		mark_page_accessed(page);
> +		folio_mark_accessed(folio);
>   	}
>   out:
>   	pte_unmap_unlock(ptep, ptl);


Acked-by: David Hildenbrand <david@redhat.com>
diff mbox series

Patch

diff --git a/mm/gup.c b/mm/gup.c
index a82890b46a36..7aecaa5ff6f3 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -922,14 +922,14 @@  static struct page *follow_page_pte(struct vm_area_struct *vma,
 	}
 	if (flags & FOLL_TOUCH) {
 		if ((flags & FOLL_WRITE) &&
-		    !pte_dirty(pte) && !PageDirty(page))
-			set_page_dirty(page);
+		    !pte_dirty(pte) && !folio_test_dirty(folio))
+			folio_mark_dirty(folio);
 		/*
 		 * pte_mkyoung() would be more correct here, but atomic care
 		 * is needed to avoid losing the dirty bit: it is easier to use
-		 * mark_page_accessed().
+		 * folio_mark_accessed().
 		 */
-		mark_page_accessed(page);
+		folio_mark_accessed(folio);
 	}
 out:
 	pte_unmap_unlock(ptep, ptl);