diff mbox series

[v3,06/14] mm/ksm: use ksm_get_folio in scan_get_next_rmap_item

Message ID 20240325124904.398913-7-alexs@kernel.org (mailing list archive)
State New
Headers show
Series transfer page to folio in KSM | expand

Commit Message

alexs@kernel.org March 25, 2024, 12:48 p.m. UTC
From: "Alex Shi (tencent)" <alexs@kernel.org>

Save a compound calls.

Signed-off-by: Alex Shi (tencent) <alexs@kernel.org>
Cc: Izik Eidus <izik.eidus@ravellosystems.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Chris Wright <chrisw@sous-sol.org>
---
 mm/ksm.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

David Hildenbrand April 5, 2024, 7:28 a.m. UTC | #1
On 25.03.24 13:48, alexs@kernel.org wrote:
> From: "Alex Shi (tencent)" <alexs@kernel.org>
> 
> Save a compound calls.
> 
> Signed-off-by: Alex Shi (tencent) <alexs@kernel.org>
> Cc: Izik Eidus <izik.eidus@ravellosystems.com>
> Cc: Matthew Wilcox <willy@infradead.org>
> Cc: Andrea Arcangeli <aarcange@redhat.com>
> Cc: Hugh Dickins <hughd@google.com>
> Cc: Chris Wright <chrisw@sous-sol.org>
> ---
>   mm/ksm.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/ksm.c b/mm/ksm.c
> index aa80fbf3a8e0..95a487a21eed 100644
> --- a/mm/ksm.c
> +++ b/mm/ksm.c
> @@ -2611,14 +2611,14 @@ static struct ksm_rmap_item *scan_get_next_rmap_item(struct page **page)
>   		 */
>   		if (!ksm_merge_across_nodes) {
>   			struct ksm_stable_node *stable_node, *next;
> -			struct page *page;
> +			struct folio *folio;
>   
>   			list_for_each_entry_safe(stable_node, next,
>   						 &migrate_nodes, list) {
> -				page = get_ksm_page(stable_node,
> -						    GET_KSM_PAGE_NOLOCK);
> -				if (page)
> -					put_page(page);
> +				folio = ksm_get_folio(stable_node,
> +						      GET_KSM_PAGE_NOLOCK);
> +				if (folio)
> +					folio_put(folio);
>   				cond_resched();
>   			}
>   		}

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

Patch

diff --git a/mm/ksm.c b/mm/ksm.c
index aa80fbf3a8e0..95a487a21eed 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -2611,14 +2611,14 @@  static struct ksm_rmap_item *scan_get_next_rmap_item(struct page **page)
 		 */
 		if (!ksm_merge_across_nodes) {
 			struct ksm_stable_node *stable_node, *next;
-			struct page *page;
+			struct folio *folio;
 
 			list_for_each_entry_safe(stable_node, next,
 						 &migrate_nodes, list) {
-				page = get_ksm_page(stable_node,
-						    GET_KSM_PAGE_NOLOCK);
-				if (page)
-					put_page(page);
+				folio = ksm_get_folio(stable_node,
+						      GET_KSM_PAGE_NOLOCK);
+				if (folio)
+					folio_put(folio);
 				cond_resched();
 			}
 		}