Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mm/mglru: fix the outdated can_swap field of the aging command
@ 2026-12-03  4:00 Chuanhua Han
  2026-12-03  5:20 ` Barry Song
  2026-12-03  6:43 ` Qi Zheng
  0 siblings, 2 replies; 3+ messages in thread
From: Chuanhua Han @ 2026-12-03  4:00 UTC (permalink / raw)
  To: Andrew Morton, David Hildenbrand, Jonathan Corbet, Kairui Song
  Cc: Axel Rasmussen, Baolin Wang, Baoquan He, Barry Song,
	Liam R. Howlett, linux-doc, linux-mm, Michal Hocko, Mike Rapoport,
	Qi Zheng, Randy Dunlap, Shakeel Butt, Shuah Khan, Vlastimil Babka,
	Wei Xu, Yuanchu Xie, Chuanhua Han, Chuanhua Han

From: Chuanhua Han <hanchuanhua@xiaomi.com>

The fourth field of the aging command in /sys/kernel/debug/lru_gen is
documented as can_swap, but lru_gen_seq_write() parses it as a
swappiness value, the same as for the eviction command.
Commit b40599930f00 ("mm: add max swappiness arg to lru_gen for
anonymous memory only") added "max" to this field, but documented it
only for eviction.

For aging, the value decides which VMAs the page table walk scans: 0
skips anon and shmem VMAs, "max" skips file VMAs other than shmem, and
any value in [1, 200] scans both. Document the field as swappiness.

Signed-off-by: Chuanhua Han <hanchuanhua@xiaomi.com>
---
v1 -> v2:
 - Reword the subject to make it clear this is a doc fix (Barry)
 - Say "VMAs" instead of "pages" and mention shmem VMAs (Barry)
 - Fix the From/Signed-off-by mismatch (Barry)
 - Drop the test notes (Barry)
v1: https://lore.kernel.org/linux-mm/20261202121419.4026587-1-hanchuanhua@xiaomi.com/

 Documentation/admin-guide/mm/multigen_lru.rst | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/Documentation/admin-guide/mm/multigen_lru.rst b/Documentation/admin-guide/mm/multigen_lru.rst
index 9cb54b4ff5d9..7c2c6af61fe0 100644
--- a/Documentation/admin-guide/mm/multigen_lru.rst
+++ b/Documentation/admin-guide/mm/multigen_lru.rst
@@ -122,10 +122,13 @@ the former is the largest and that of the latter is the smallest.
 Users can write the following command to ``lru_gen`` to create a new
 generation ``max_gen_nr+1``:
 
-    ``+ memcg_id node_id max_gen_nr [can_swap [force_scan]]``
+    ``+ memcg_id node_id max_gen_nr [swappiness [force_scan]]``
 
-``can_swap`` defaults to the swap setting and, if it is set to ``1``,
-it forces the scan of anon pages when swap is off, and vice versa.
+``swappiness`` overrides the default value in ``/proc/sys/vm/swappiness``
+and the valid range is [0-200, max]. If it is set to ``0``, the page
+table walk skips anon and shmem VMAs; if it is set to ``max``, it skips
+file VMAs other than shmem; otherwise, it scans both. For any nonzero
+value, anon and shmem VMAs are scanned even when swap is off.
 ``force_scan`` defaults to ``1`` and, if it is set to ``0``, it
 employs heuristics to reduce the overhead, which is likely to reduce
 the coverage as well.
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] mm/mglru: fix the outdated can_swap field of the aging command
  2026-12-03  4:00 [PATCH v2] mm/mglru: fix the outdated can_swap field of the aging command Chuanhua Han
@ 2026-12-03  5:20 ` Barry Song
  2026-12-03  6:43 ` Qi Zheng
  1 sibling, 0 replies; 3+ messages in thread
From: Barry Song @ 2026-12-03  5:20 UTC (permalink / raw)
  To: Chuanhua Han
  Cc: Andrew Morton, David Hildenbrand, Jonathan Corbet, Kairui Song,
	Axel Rasmussen, Baolin Wang, Baoquan He, Liam R. Howlett,
	linux-doc, linux-mm, Michal Hocko, Mike Rapoport, Qi Zheng,
	Randy Dunlap, Shakeel Butt, Shuah Khan, Vlastimil Babka, Wei Xu,
	Yuanchu Xie, Chuanhua Han

On Thu, Dec 3, 2026 at 12:00 PM Chuanhua Han <hanchuanhua802@gmail.com> wrote:
>
> From: Chuanhua Han <hanchuanhua@xiaomi.com>
>
> The fourth field of the aging command in /sys/kernel/debug/lru_gen is
> documented as can_swap, but lru_gen_seq_write() parses it as a
> swappiness value, the same as for the eviction command.
> Commit b40599930f00 ("mm: add max swappiness arg to lru_gen for
> anonymous memory only") added "max" to this field, but documented it
> only for eviction.
>
> For aging, the value decides which VMAs the page table walk scans: 0
> skips anon and shmem VMAs, "max" skips file VMAs other than shmem, and
> any value in [1, 200] scans both. Document the field as swappiness.
>
> Signed-off-by: Chuanhua Han <hanchuanhua@xiaomi.com>
> ---
> v1 -> v2:
>  - Reword the subject to make it clear this is a doc fix (Barry)
>  - Say "VMAs" instead of "pages" and mention shmem VMAs (Barry)
>  - Fix the From/Signed-off-by mismatch (Barry)
>  - Drop the test notes (Barry)
> v1: https://lore.kernel.org/linux-mm/20261202121419.4026587-1-hanchuanhua@xiaomi.com/

Thanks,

Reviewed-by: Barry Song <baohua@kernel.org>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] mm/mglru: fix the outdated can_swap field of the aging command
  2026-12-03  4:00 [PATCH v2] mm/mglru: fix the outdated can_swap field of the aging command Chuanhua Han
  2026-12-03  5:20 ` Barry Song
@ 2026-12-03  6:43 ` Qi Zheng
  1 sibling, 0 replies; 3+ messages in thread
From: Qi Zheng @ 2026-12-03  6:43 UTC (permalink / raw)
  To: Chuanhua Han, Andrew Morton, David Hildenbrand, Jonathan Corbet,
	Kairui Song
  Cc: Axel Rasmussen, Baolin Wang, Baoquan He, Barry Song,
	Liam R. Howlett, linux-doc, linux-mm, Michal Hocko, Mike Rapoport,
	Randy Dunlap, Shakeel Butt, Shuah Khan, Vlastimil Babka, Wei Xu,
	Yuanchu Xie, Chuanhua Han

Hi Chuanhua,

On 12/3/26 12:00 PM, Chuanhua Han wrote:
> From: Chuanhua Han <hanchuanhua@xiaomi.com>
> 
> The fourth field of the aging command in /sys/kernel/debug/lru_gen is
> documented as can_swap, but lru_gen_seq_write() parses it as a
> swappiness value, the same as for the eviction command.
> Commit b40599930f00 ("mm: add max swappiness arg to lru_gen for
> anonymous memory only") added "max" to this field, but documented it
> only for eviction.
> 
> For aging, the value decides which VMAs the page table walk scans: 0
> skips anon and shmem VMAs, "max" skips file VMAs other than shmem, and
> any value in [1, 200] scans both. Document the field as swappiness.
> 
> Signed-off-by: Chuanhua Han <hanchuanhua@xiaomi.com>
> ---
> v1 -> v2:
>   - Reword the subject to make it clear this is a doc fix (Barry)
>   - Say "VMAs" instead of "pages" and mention shmem VMAs (Barry)
>   - Fix the From/Signed-off-by mismatch (Barry)
>   - Drop the test notes (Barry)
> v1: https://lore.kernel.org/linux-mm/20261202121419.4026587-1-hanchuanhua@xiaomi.com/
> 
>   Documentation/admin-guide/mm/multigen_lru.rst | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/admin-guide/mm/multigen_lru.rst b/Documentation/admin-guide/mm/multigen_lru.rst
> index 9cb54b4ff5d9..7c2c6af61fe0 100644
> --- a/Documentation/admin-guide/mm/multigen_lru.rst
> +++ b/Documentation/admin-guide/mm/multigen_lru.rst
> @@ -122,10 +122,13 @@ the former is the largest and that of the latter is the smallest.
>   Users can write the following command to ``lru_gen`` to create a new
>   generation ``max_gen_nr+1``:
>   
> -    ``+ memcg_id node_id max_gen_nr [can_swap [force_scan]]``
> +    ``+ memcg_id node_id max_gen_nr [swappiness [force_scan]]``
>   
> -``can_swap`` defaults to the swap setting and, if it is set to ``1``,
> -it forces the scan of anon pages when swap is off, and vice versa.
> +``swappiness`` overrides the default value in ``/proc/sys/vm/swappiness``

Or could this also be `memcg->swappiness` under cgroup v1?

> +and the valid range is [0-200, max]. If it is set to ``0``, the page
> +table walk skips anon and shmem VMAs; if it is set to ``max``, it skips
> +file VMAs other than shmem; otherwise, it scans both. For any nonzero
> +value, anon and shmem VMAs are scanned even when swap is off.

It reads a bit odd at first glance.

Maybe add a note on why we still need to scan here — e.g. to update the
stats? Demotion could also be a case?

Thanks,
Qi

>   ``force_scan`` defaults to ``1`` and, if it is set to ``0``, it
>   employs heuristics to reduce the overhead, which is likely to reduce
>   the coverage as well.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-03  6:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03  4:00 [PATCH v2] mm/mglru: fix the outdated can_swap field of the aging command Chuanhua Han
2026-12-03  5:20 ` Barry Song
2026-12-03  6:43 ` Qi Zheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox