[PATCH v4 1/7] mm/Kconfig: Add LRU_GEN_WALKS_SECONDARY_MMU

James Houghton
2024-05-29T18:05:35Z

Add this option so that one building the kernel can choose whether or
not they want to support walking the secondary MMU.

We want users to be able to blindly enable all lru_gen features to have
the best possible performance most of the time. Walking the secondary
MMU is mainly useful for be able to do proactive reclaim, and it is
possible that doing this can harm VM performance.

This option should be enabled by users who run VMs and also care to do
proactive aging/reclaim with MGLRU.

With this config option enabled, a user can still disable the
new functionality at runtime through sysfs.

Signed-off-by: James Houghton <jthoughton@google.com>
---
mm/Kconfig | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/mm/Kconfig b/mm/Kconfig
index b4cb45255a54..3ac4b1dbf745 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -1222,6 +1222,14 @@ config LRU_GEN_STATS

This option has a per-memcg and per-node memory overhead.

+config LRU_GEN_WALKS_SECONDARY_MMU
+ bool "Walk secondary MMUs when aging"
+ depends on LRU_GEN && LRU_GEN_WALKS_MMU
+ help
+ This option allows multi-gen LRU to walk secondary MMU page tables
+ when aging. This allows for proactive reclaim, but this can reduce
+ overall performance (e.g. for a KVM VM).
+
config LRU_GEN_WALKS_MMU
def_bool y
depends on LRU_GEN && ARCH_HAS_HW_PTE_YOUNG
--
2.45.1.288.g0e0cd299f1-goog