Skip to content

Commit 03939cf

Browse files
committed
Merge branch 'for-next/mm' into for-next/core
* for-next/mm: arm64: enable THP_SWAP for arm64
2 parents 02eab44 + d0637c5 commit 03939cf

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

arch/arm64/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ config ARM64
101101
select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
102102
select ARCH_WANT_LD_ORPHAN_WARN
103103
select ARCH_WANTS_NO_INSTR
104+
select ARCH_WANTS_THP_SWAP if ARM64_4K_PAGES
104105
select ARCH_HAS_UBSAN_SANITIZE_ALL
105106
select ARM_AMBA
106107
select ARM_ARCH_TIMER

arch/arm64/include/asm/pgtable.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@
4545
__flush_tlb_range(vma, addr, end, PUD_SIZE, false, 1)
4646
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
4747

48+
static inline bool arch_thp_swp_supported(void)
49+
{
50+
return !system_supports_mte();
51+
}
52+
#define arch_thp_swp_supported arch_thp_swp_supported
53+
4854
/*
4955
* Outside of a few very special situations (e.g. hibernation), we always
5056
* use broadcast TLB invalidation instructions, therefore a spurious page

include/linux/huge_mm.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,4 +461,16 @@ static inline int split_folio_to_list(struct folio *folio,
461461
return split_huge_page_to_list(&folio->page, list);
462462
}
463463

464+
/*
465+
* archs that select ARCH_WANTS_THP_SWAP but don't support THP_SWP due to
466+
* limitations in the implementation like arm64 MTE can override this to
467+
* false
468+
*/
469+
#ifndef arch_thp_swp_supported
470+
static inline bool arch_thp_swp_supported(void)
471+
{
472+
return true;
473+
}
474+
#endif
475+
464476
#endif /* _LINUX_HUGE_MM_H */

mm/swap_slots.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ swp_entry_t folio_alloc_swap(struct folio *folio)
307307
entry.val = 0;
308308

309309
if (folio_test_large(folio)) {
310-
if (IS_ENABLED(CONFIG_THP_SWAP))
310+
if (IS_ENABLED(CONFIG_THP_SWAP) && arch_thp_swp_supported())
311311
get_swap_pages(1, &entry, folio_nr_pages(folio));
312312
goto out;
313313
}

0 commit comments

Comments
 (0)