From 38f39982fd21a739cedb953508ea9bc952df00fd Mon Sep 17 00:00:00 2001 From: Huacai Chen Date: Tue, 14 May 2024 12:24:18 +0800 Subject: [PATCH] LoongArch: Select THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE THP_SWAP has been proven to improve the swap throughput significantly on x86_64 system according to commit bd4c82c22c367e0 ("mm, THP, swap: delay splitting THP after swapped out"), on ARM64 system according to commit d0637c505f8a1d ("arm64: enable THP_SWAP for arm64") and on RISC-V system according to commit 87f81e66e2e84c7 ("riscv: enable THP_SWAP for RV64"). Enable THP_SWAP for LoongArch, testing the micro-benchmark which is introduced by commit d0637c505f8a1d ("arm64: enable THP_SWAP for arm64") shows below numbers on the Loongson-3A5000 board: swp out bandwidth w/o patch: 1815716 bytes/ms (mean of 10 tests) swp out bandwidth w/ patch: 3410003 bytes/ms (mean of 10 tests) Improved by 46.75%! Signed-off-by: Huacai Chen [Tested in 3A6000,seem not improved, but improved in 3C5000] Before: for((i=10;i>=1;i--)); do ./a.out; done; swp out bandwidth: 3153612 bytes/ms swp out bandwidth: 3153612 bytes/ms swp out bandwidth: 3153612 bytes/ms swp out bandwidth: 3106891 bytes/ms swp out bandwidth: 3153612 bytes/ms swp out bandwidth: 3153612 bytes/ms swp out bandwidth: 3153612 bytes/ms swp out bandwidth: 3084047 bytes/ms swp out bandwidth: 3647220 bytes/ms swp out bandwidth: 3647220 bytes/ms After: swp out bandwidth: 1997287 bytes/ms swp out bandwidth: 3017484 bytes/ms swp out bandwidth: 9118052 bytes/ms swp out bandwidth: 10485760 bytes/ms swp out bandwidth: 10754625 bytes/ms swp out bandwidth: 9320675 bytes/ms swp out bandwidth: 10485760 bytes/ms swp out bandwidth: 10485760 bytes/ms swp out bandwidth: 10754625 bytes/ms swp out bandwidth: 9118052 bytes/ms (cherry picked from commit ff4a2443ef88874943f6d8444fb86327ec6f96b0) Signed-off-by: Wentao Guan --- arch/loongarch/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig index 4e1f162bde3a4..8e0b468f04e03 100644 --- a/arch/loongarch/Kconfig +++ b/arch/loongarch/Kconfig @@ -72,6 +72,7 @@ config LOONGARCH select ARCH_WANT_LD_ORPHAN_WARN select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP select ARCH_WANTS_NO_INSTR + select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE select BUILDTIME_TABLE_SORT select COMMON_CLK select CPU_PM