Merge keystone/android14-6.1-keystone-qcom-release.6.1.57 (daf56c4) into qcom-6.1

* refs/heads/tmp-daf56c4:
  FROMLIST: mm: migrate high-order folios in swap cache correctly

Change-Id: Ief52fd313a8a922caa272b8050775494170d6ad2
Upstream-Build: ks_qcom-android14-6.1-keystone-qcom-release@11305096 UKQ2.240112.001
Signed-off-by: Srinivasarao Pathipati <quic_c_spathi@quicinc.com>
This commit is contained in:
Srinivasarao Pathipati 2024-01-14 12:22:57 +05:30
commit 5e321b7e89
2 changed files with 10 additions and 3 deletions

View File

@ -1,2 +1,2 @@
a2fa77d36d26b574cffec6766df50a711f305450
android14-6.1-2023-11_r3
6dd1f54e29ea4c4ec0c508ab8a7b78991e2ca25b
android14-6.1-2023-12_r2

View File

@ -393,6 +393,7 @@ int folio_migrate_mapping(struct address_space *mapping,
int dirty;
int expected_count = folio_expected_refs(mapping, folio) + extra_count;
long nr = folio_nr_pages(folio);
long entries, i;
if (!mapping) {
/* Anonymous page without mapping */
@ -430,8 +431,10 @@ int folio_migrate_mapping(struct address_space *mapping,
folio_set_swapcache(newfolio);
newfolio->private = folio_get_private(folio);
}
entries = nr;
} else {
VM_BUG_ON_FOLIO(folio_test_swapcache(folio), folio);
entries = 1;
}
/* Move dirty while page refs frozen and newpage not yet exposed */
@ -441,7 +444,11 @@ int folio_migrate_mapping(struct address_space *mapping,
folio_set_dirty(newfolio);
}
xas_store(&xas, newfolio);
/* Swap cache still stores N entries instead of a high-order entry */
for (i = 0; i < entries; i++) {
xas_store(&xas, newfolio);
xas_next(&xas);
}
/*
* Drop cache reference from old page by unfreezing