Add configuration options for the multigenerational lru. Signed-off-by: Yu Zhao <yuzhao@xxxxxxxxxx> Tested-by: Konstantin Kharlamov <Hi-Angel@xxxxxxxxx> --- Documentation/vm/multigen_lru.rst | 18 ++++++++++++ mm/Kconfig | 48 +++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/Documentation/vm/multigen_lru.rst b/Documentation/vm/multigen_lru.rst index 6f9e0181348b..a54c5637c455 100644 --- a/Documentation/vm/multigen_lru.rst +++ b/Documentation/vm/multigen_lru.rst @@ -6,6 +6,13 @@ Multigenerational LRU Quick start =========== +Build configurations +-------------------- +:Required: Set ``CONFIG_LRU_GEN=y``. + +:Optional: Set ``CONFIG_LRU_GEN_ENABLED=y`` to enable this feature by + default. + Runtime configurations ---------------------- :Required: Write ``1`` to ``/sys/kernel/mm/lru_gen/enable`` if the @@ -25,6 +32,17 @@ Personal computers Data centers ------------ +:Optional: Change ``CONFIG_NR_LRU_GENS`` to a larger value to support + more generations for ``Working set estimation`` and + ``Proactive reclaim``. + +:Optional: Change ``CONFIG_TIERS_PER_GEN`` to a larger value to + support more tiers, which generally provide better protection for + page cache when under heavy buffered I/O workloads. + +:Optional: Set ``CONFIG_LRU_GEN_STATS=y`` to enable full stats for + debugging. See ``Debugfs interface``. + :Debugfs interface: ``/sys/kernel/debug/lru_gen`` has the following format: :: diff --git a/mm/Kconfig b/mm/Kconfig index 356f4f2c779e..8a33605917f5 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -900,6 +900,54 @@ config IO_MAPPING config SECRETMEM def_bool ARCH_HAS_SET_DIRECT_MAP && !EMBEDDED +# multigenerational lru { +config LRU_GEN + bool "Multigenerational LRU" + depends on MMU + # the following options can use up the spare bits in page flags + depends on !MAXSMP && (64BIT || !SPARSEMEM || SPARSEMEM_VMEMMAP) + help + A high performance LRU implementation for memory overcommit. See + Documentation/vm/multigen_lru.rst for details. + +config LRU_GEN_ENABLED + bool "Enable by default" + depends on LRU_GEN + help + This option enables the multigenerational lru by default. + +config NR_LRU_GENS + int "Max number of generations" + depends on LRU_GEN + range 4 31 + default 4 + help + This option uses order_base_2(N+1) bits in page flags. + + Do not configure more generations than you plan to use. They have a + per-memcg and per-node memory overhead. + +config TIERS_PER_GEN + int "Number of tiers per generation" + depends on LRU_GEN + range 2 5 + default 4 + help + This option uses N-2 bits in page flags. + + Larger values generally provide better protection for page cache when + under heavy buffered I/O workloads. + +config LRU_GEN_STATS + bool "Full stats for debugging" + depends on LRU_GEN + help + This option keeps historical stats for evicted generations. + + Do not enable full stats unless you plan to look at them. They have a + per-memcg and per-node memory overhead. +# } + source "mm/damon/Kconfig" endmenu -- 2.34.1.448.ga2b2bfdf31-goog