aboutsummaryrefslogtreecommitdiffstats
path: root/lib/test_xarray.c
diff options
context:
space:
mode:
authorBarry Song <[email protected]>2024-03-22 11:41:36 +0000
committerAndrew Morton <[email protected]>2024-04-26 03:56:07 +0000
commitf238b8c33c6738f146bbfbb09b78870ea157c2b7 (patch)
treeaa96e10de8e816f42edce4dd19a08e5de39ca19a /lib/test_xarray.c
parentselftests/mm: parse VMA range in one go (diff)
downloadkernel-f238b8c33c6738f146bbfbb09b78870ea157c2b7.tar.gz
kernel-f238b8c33c6738f146bbfbb09b78870ea157c2b7.zip
arm64: mm: swap: support THP_SWAP on hardware with MTE
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. arch_prepare_to_swap() should take folio rather than page as parameter because we support THP swap-out as a whole. It saves tags for all pages in a large folio. As now we are restoring tags based-on folio, in arch_swap_restore(), we may increase some extra loops and early-exitings while refaulting a large folio which is still in swapcache in do_swap_page(). In case a large folio has nr pages, do_swap_page() will only set the PTE of the particular page which is causing the page fault. Thus do_swap_page() runs nr times, and each time, arch_swap_restore() will loop nr times for those subpages in the folio. So right now the algorithmic complexity becomes O(nr^2). Once we support mapping large folios in do_swap_page(), extra loops and early-exitings will decrease while not being completely removed as a large folio might get partially tagged in corner cases such as, 1. a large folio in swapcache can be partially unmapped, thus, MTE tags for the unmapped pages will be invalidated; 2. users might use mprotect() to set MTEs on a part of a large folio. arch_thp_swp_supported() is dropped since ARM64 MTE was the only one who needed it. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Barry Song <[email protected]> Reviewed-by: Steven Price <[email protected]> Acked-by: Chris Li <[email protected]> Reviewed-by: Ryan Roberts <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Will Deacon <[email protected]> Cc: Mark Rutland <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Kemeng Shi <[email protected]> Cc: "Matthew Wilcox (Oracle)" <[email protected]> Cc: Anshuman Khandual <[email protected]> Cc: Peter Collingbourne <[email protected]> Cc: Yosry Ahmed <[email protected]> Cc: Peter Xu <[email protected]> Cc: Lorenzo Stoakes <[email protected]> Cc: "Mike Rapoport (IBM)" <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: "Aneesh Kumar K.V" <[email protected]> Cc: Rick Edgecombe <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'lib/test_xarray.c')
0 files changed, 0 insertions, 0 deletions