Re: [PATCH v9 13/14] mm: multi-gen LRU: admin guide
From: Mike Rapoport <rppt@kernel.org>
Date: 2022-03-10 12:30:13
Also in:
linux-doc, linux-mm, lkml
Hi, On Tue, Mar 08, 2022 at 07:12:30PM -0700, Yu Zhao wrote:
quoted hunk ↗ jump to hunk
Add an admin guide. Signed-off-by: Yu Zhao <redacted> Acked-by: Brian Geffon <redacted> Acked-by: Jan Alexander Steffens (heftig) <redacted> Acked-by: Oleksandr Natalenko <redacted> Acked-by: Steven Barrett <redacted> Acked-by: Suleiman Souhlal <redacted> Tested-by: Daniel Byrne <redacted> Tested-by: Donald Carr <redacted> Tested-by: Holger Hoffstätte <redacted> Tested-by: Konstantin Kharlamov <redacted> Tested-by: Shuang Zhai <redacted> Tested-by: Sofia Trinh <redacted> Tested-by: Vaibhav Jain <redacted> --- Documentation/admin-guide/mm/index.rst | 1 + Documentation/admin-guide/mm/multigen_lru.rst | 146 ++++++++++++++++++ mm/Kconfig | 3 +- 3 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 Documentation/admin-guide/mm/multigen_lru.rstdiff --git a/Documentation/admin-guide/mm/index.rst b/Documentation/admin-guide/mm/index.rst index c21b5823f126..2cf5bae62036 100644 --- a/Documentation/admin-guide/mm/index.rst +++ b/Documentation/admin-guide/mm/index.rst@@ -32,6 +32,7 @@ the Linux memory management. idle_page_tracking ksm memory-hotplug + multigen_lru nommu-mmap numa_memory_policy numaperfdiff --git a/Documentation/admin-guide/mm/multigen_lru.rst b/Documentation/admin-guide/mm/multigen_lru.rst new file mode 100644 index 000000000000..4ea6a801dc56 --- /dev/null +++ b/Documentation/admin-guide/mm/multigen_lru.rst@@ -0,0 +1,146 @@ +.. SPDX-License-Identifier: GPL-2.0 + +============= +Multi-Gen LRU +=============
I'm still missing an opening paragraph the explains what is Multi-gen LRU and why users would want it. Something like Multi-gen LRU is an efficient mechanism for page reclamation. More details are of course welcome :)
+Quick start +=========== +Build the kernel with the following configurations. + +* ``CONFIG_LRU_GEN=y`` +* ``CONFIG_LRU_GEN_ENABLED=y`` + +All set! + +Runtime options +=============== +``/sys/kernel/mm/lru_gen/`` contains stable ABIs described in the +following subsections. + +Kill switch +----------- +``enable`` accepts different values to enable or disabled the
^ disable
+following components. The default value of this file depends on +``CONFIG_LRU_GEN_ENABLED``. All the components should be enabled +unless some of them have unforeseen side effects. Writing to +``enable`` has no effect when a component is not supported by the +hardware, and valid values will be accepted even when the main switch +is off. + +====== =============================================================== +Values Components +====== =============================================================== +0x0001 The main switch for the multi-gen LRU. +0x0002 Clearing the accessed bit in leaf page table entries in large + batches, when MMU sets it (e.g., on x86). This behavior can + theoretically worsen lock contention (mmap_lock). If it is + disabled, the multi-gen LRU will suffer a minor performance + degradation. +0x0004 Clearing the accessed bit in non-leaf page table entries as + well, when MMU sets it (e.g., on x86). This behavior was not + verified on x86 varieties other than Intel and AMD. If it is + disabled, the multi-gen LRU will suffer a negligible + performance degradation. +[yYnN] Apply to all the components above. +====== =============================================================== + +E.g., +:: + + echo y >/sys/kernel/mm/lru_gen/enabled + cat /sys/kernel/mm/lru_gen/enabled + 0x0007 + echo 5 >/sys/kernel/mm/lru_gen/enabled + cat /sys/kernel/mm/lru_gen/enabled + 0x0005 + +Thrashing prevention +-------------------- +Personal computers are more sensitive to thrashing because it can +cause janks (lags when rendering UI) and negatively impact user +experience. The multi-gen LRU offers thrashing prevention to the +majority of laptop and desktop users who do not have ``oomd``. + +Users can write ``N`` to ``min_ttl_ms`` to prevent the working set of +``N`` milliseconds from getting evicted. The OOM killer is triggered +if this working set cannot be kept in memory. In other words, this +option works as an adjustable pressure relief valve, and when open, it +terminates applications that are hopefully not being used. + +Based on the average human detectable lag (~100ms), ``N=1000`` usually +eliminates intolerable janks due to thrashing. Larger values like +``N=3000`` make janks less noticeable at the risk of premature OOM +kills.
What is the default value of min_ttl_ms?
+ +Experimental features +=====================
-- Sincerely yours, Mike. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel