On Sat, Mar 23, 2024 at 12:41:36AM +1300, Barry Song wrote: > Commit d0637c505f8a1 ("arm64: enable THP_SWAP for arm64") brings up > THP_SWAP on ARM64, but it doesn't enable THP_SWP on hardware with > MTE as the MTE code works with the assumption tags save/restore is > always handling a folio with only one page. > > The limitation should be removed as more and more ARM64 SoCs have > this feature. Co-existence of MTE and THP_SWAP becomes more and > more important. > > This patch makes MTE tags saving support large folios, then we don't > need to split large folios into base pages for swapping out on ARM64 > SoCs with MTE any more. Can we go further than this patch and only support PG_mte_tagged and PG_mte_lock on folio->flags instead of page->flags? We're down to using page->flags for these two MTE bits, a whole lot of s390 junk, PG_hwpoison, PG_head, PG_anon_exclusive and Zone/Section/Node/KASAN/last_cpupid. Looking at some of the callers, the call in copy_highpage() would need to be lifted to its caller so that we only set the tags once per folio rather than try to set them per page of a folio ... might be a bit of churn, and I'd hate to try to do it myself without being able to test it.