On 5 Mar 2024, at 11:22, Charan Teja Kalla wrote: > Thanks David for various inputs on this patch!!. > > On 3/5/2024 9:47 PM, Zi Yan wrote: >> On 5 Mar 2024, at 11:13, Zi Yan wrote: >> >>> From: Zi Yan <ziy@xxxxxxxxxx> >>> >>> The tail pages in a THP can have swap entry information stored in their >>> private field. When migrating to a new page, all tail pages of the new >>> page need to update ->private to avoid future data corruption. >> >> Corresponding swapcache entries need to be updated as well. >> e71769ae5260 ("mm: enable thp migration for shmem thp") fixed it already. >> >> Fixes: 616b8371539a ("mm: thp: enable thp migration in generic path") >> > > Thanks Zi Yan, for posting this patch. I think below tag too applicable? > > Closes: > https://lore.kernel.org/linux-mm/1707814102-22682-1-git-send-email-quic_charante@xxxxxxxxxxx/ Right. Let me add it to other stable fixes I am going to send. Hi Greg, Could you add the information above (text, Fixes, and Closes) to this patch? Or do you want me to resend? Thanks. > >> >>> >>> Signed-off-by: Zi Yan <ziy@xxxxxxxxxx> >>> --- >>> mm/migrate.c | 6 +++++- >>> 1 file changed, 5 insertions(+), 1 deletion(-) >>> >>> diff --git a/mm/migrate.c b/mm/migrate.c >>> index c93dd6a31c31..c5968021fde0 100644 >>> --- a/mm/migrate.c >>> +++ b/mm/migrate.c >>> @@ -423,8 +423,12 @@ int folio_migrate_mapping(struct address_space *mapping, >>> if (folio_test_swapbacked(folio)) { >>> __folio_set_swapbacked(newfolio); >>> if (folio_test_swapcache(folio)) { >>> + int i; >>> + >>> folio_set_swapcache(newfolio); >>> - newfolio->private = folio_get_private(folio); >>> + for (i = 0; i < nr; i++) >>> + set_page_private(folio_page(newfolio, i), >>> + page_private(folio_page(folio, i))); >>> } >>> entries = nr; >>> } else { >>> -- >>> 2.43.0 >> >> >> -- >> Best Regards, >> Yan, Zi -- Best Regards, Yan, Zi
Attachment:
signature.asc
Description: OpenPGP digital signature