Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/page_owner: preserve original free_pid/free_tgid during folio migration
@ 2026-09-03  9:21 Hongfu Li
  2026-09-03  9:43 ` Vlastimil Babka (SUSE)
  0 siblings, 1 reply; 2+ messages in thread
From: Hongfu Li @ 2026-09-03  9:21 UTC (permalink / raw)
  To: akpm, vbabka, surenb, mhocko, brendan.jackman, hannes, ziy
  Cc: linux-mm, linux-kernel, hongfu.li, Hongfu Li

From: Hongfu Li <lihongfu@kylinos.cn>

__update_page_owner_free_handle() accepts pid and tgid, but ignores
them, always storing current->pid and current->tgid.

__folio_copy_owner() forwards the original free pid/tgid during folio
migration, yet these values were overwritten by the migrating task.

Store the passed-in pid/tgid so the migrated folio keeps the original
free attribution.

Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>
---
 mm/page_owner.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/page_owner.c b/mm/page_owner.c
index 3fc37d9b908e..cfc31c92d765 100644
--- a/mm/page_owner.c
+++ b/mm/page_owner.c
@@ -307,8 +307,8 @@ static inline void __update_page_owner_free_handle(struct page *page,
 			page_owner->free_handle = handle;
 		}
 		page_owner->free_ts_nsec = free_ts_nsec;
-		page_owner->free_pid = current->pid;
-		page_owner->free_tgid = current->tgid;
+		page_owner->free_pid = pid;
+		page_owner->free_tgid = tgid;
 	}
 	rcu_read_unlock();
 }
-- 
2.54.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm/page_owner: preserve original free_pid/free_tgid during folio migration
  2026-09-03  9:21 [PATCH] mm/page_owner: preserve original free_pid/free_tgid during folio migration Hongfu Li
@ 2026-09-03  9:43 ` Vlastimil Babka (SUSE)
  0 siblings, 0 replies; 2+ messages in thread
From: Vlastimil Babka (SUSE) @ 2026-09-03  9:43 UTC (permalink / raw)
  To: Hongfu Li, akpm, surenb, mhocko, brendan.jackman, hannes, ziy
  Cc: linux-mm, linux-kernel, Hongfu Li

On 9/3/26 11:21, Hongfu Li wrote:
> From: Hongfu Li <lihongfu@kylinos.cn>
> 
> __update_page_owner_free_handle() accepts pid and tgid, but ignores
> them, always storing current->pid and current->tgid.
> 
> __folio_copy_owner() forwards the original free pid/tgid during folio
> migration, yet these values were overwritten by the migrating task.
> 
> Store the passed-in pid/tgid so the migrated folio keeps the original
> free attribution.
> 
> Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>

Fixes: ea4b5b33bf8a ("mm,page_owner: update metadata for tail pages")

(not critical enough stable@ imho)

Acked-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>

Thanks!

> ---
>  mm/page_owner.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/page_owner.c b/mm/page_owner.c
> index 3fc37d9b908e..cfc31c92d765 100644
> --- a/mm/page_owner.c
> +++ b/mm/page_owner.c
> @@ -307,8 +307,8 @@ static inline void __update_page_owner_free_handle(struct page *page,
>  			page_owner->free_handle = handle;
>  		}
>  		page_owner->free_ts_nsec = free_ts_nsec;
> -		page_owner->free_pid = current->pid;
> -		page_owner->free_tgid = current->tgid;
> +		page_owner->free_pid = pid;
> +		page_owner->free_tgid = tgid;
>  	}
>  	rcu_read_unlock();
>  }



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-03  9:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-03  9:21 [PATCH] mm/page_owner: preserve original free_pid/free_tgid during folio migration Hongfu Li
2026-09-03  9:43 ` Vlastimil Babka (SUSE)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox