mm/page_owner: preserve original free_pid/free_tgid during folio migration

__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.

Link: https://lore.kernel.org/20260903092126.24685-1-hongfu.li@linux.dev
Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Cc: Brendan Jackman <brendan.jackman@linux.dev>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Zi Yan <ziy@nvidia.com>
This commit is contained in:
Hongfu Li 2026-09-03 17:21:26 +08:00 committed by Andrew Morton
parent 600c820b8e
commit e1e8650302

View File

@ -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();
}