* Re: [PATCH] mm: vmscan : pgdemote vmstat is not getting updated when MGLRU is enabled.
2025-01-09 6:05 [PATCH] mm: vmscan : pgdemote vmstat is not getting updated when MGLRU is enabled Donet Tom
@ 2025-01-09 6:46 ` Yu Zhao
2025-01-11 2:07 ` Li Zhijian
2025-01-11 2:10 ` Li Zhijian
2 siblings, 0 replies; 4+ messages in thread
From: Yu Zhao @ 2025-01-09 6:46 UTC (permalink / raw)
To: Donet Tom
Cc: Andrew Morton, Kaiyang Zhao, linux-mm, linux-kernel,
Ritesh Harjani, Aneesh Kumar K . V, David Rientjes,
Johannes Weiner, Michal Hocko, Muchun Song, Roman Gushchin,
Shakeel Butt, Wei Xu
On Wed, Jan 8, 2025 at 11:05 PM Donet Tom <donettom@linux.ibm.com> wrote:
>
> When MGLRU is enabled, the pgdemote_kswapd, pgdemote_direct, and
> pgdemote_khugepaged stats in vmstat are not being updated.
>
> 'Commit f77f0c751478 ("mm,memcg: provide per-cgroup counters for
> NUMA balancing operations")' moved the pgdemote vmstat update
> from demote_folio_list() to shrink_inactive_list(), which is in
> the normal LRU path. As a result, the pgdemote stats are updated
> correctly for the normal LRU but not for MGLRU.
>
> To address this, we have added the pgdemote stat update in the
> evict_folios() function, which is in the MGLRU path. With this
> patch, the pgdemote stats will now be updated correctly when MGLRU
> is enabled.
>
> Without this patch vmstat output when MGLRU is enabled
> ======================================================
> pgdemote_kswapd 0
> pgdemote_direct 0
> pgdemote_khugepaged 0
>
> With this patch vmstat output when MGLRU is enabled
> ===================================================
> pgdemote_kswapd 43234
> pgdemote_direct 4691
> pgdemote_khugepaged 0
>
> Fixes: f77f0c751478 ("mm,memcg: provide per-cgroup counters for NUMA balancing operations")
> Signed-off-by: Donet Tom <donettom@linux.ibm.com>
Acked-by: Yu Zhao <yuzhao@google.com>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] mm: vmscan : pgdemote vmstat is not getting updated when MGLRU is enabled.
2025-01-09 6:05 [PATCH] mm: vmscan : pgdemote vmstat is not getting updated when MGLRU is enabled Donet Tom
2025-01-09 6:46 ` Yu Zhao
@ 2025-01-11 2:07 ` Li Zhijian
2025-01-11 2:10 ` Li Zhijian
2 siblings, 0 replies; 4+ messages in thread
From: Li Zhijian @ 2025-01-11 2:07 UTC (permalink / raw)
To: donettom
Cc: akpm, aneesh.kumar, hannes, kaiyang2, linux-kernel, linux-mm,
mhocko, muchun.song, rientjes, ritesh.list, roman.gushchin,
shakeel.butt, weixugc, yuzhao
> When MGLRU is enabled, the pgdemote_kswapd, pgdemote_direct, and
> pgdemote_khugepaged stats in vmstat are not being updated.
>
> 'Commit f77f0c751478 ("mm,memcg: provide per-cgroup counters for
> NUMA balancing operations")' moved the pgdemote vmstat update
> from demote_folio_list() to shrink_inactive_list(), which is in
> the normal LRU path. As a result, the pgdemote stats are updated
> correctly for the normal LRU but not for MGLRU.
>
> To address this, we have added the pgdemote stat update in the
> evict_folios() function, which is in the MGLRU path. With this
> patch, the pgdemote stats will now be updated correctly when MGLRU
> is enabled.
>
> Without this patch vmstat output when MGLRU is enabled
> ======================================================
> pgdemote_kswapd 0
> pgdemote_direct 0
> pgdemote_khugepaged 0
>
> With this patch vmstat output when MGLRU is enabled
> ===================================================
> pgdemote_kswapd 43234
> pgdemote_direct 4691
> pgdemote_khugepaged 0
>
> Fixes: f77f0c751478 ("mm,memcg: provide per-cgroup counters for NUMA balancing operations")
> Signed-off-by: Donet Tom <donettom@linux.ibm.com>
Great minds think alike, It's excatly same with mine[0] :)
There is another bug[1] as well.
[0]
https://lore.kernel.org/linux-mm/20250110122133.423481-2-lizhijian@fujitsu.com/
[1]
https://lore.kernel.org/linux-mm/20250110122133.423481-1-lizhijian@fujitsu.com/
Feel free to add vvv if your patch is accepted at last.
Tested-by: Li Zhijian <lizhijian@fujitsu.com> Reviewed-by: Li Zhijian
<lizhijian@fujitsu.com>
> ---
> mm/vmscan.c <https://lore.kernel.org/lkml/20250109060540.451261-1-donettom@linux.ibm.com/#Z31mm:vmscan.c> | 3 +++
> 1 filechanged <https://lore.kernel.org/lkml/20250109060540.451261-1-donettom@linux.ibm.com/#related>, 3 insertions(+)
>
> diff
> <https://lore.kernel.org/lkml/20250109060540.451261-1-donettom@linux.ibm.com/#iZ31mm:vmscan.c>
> --git a/mm/vmscan.c b/mm/vmscan.c index 9a859b7d18d7..b1ec5ece067e
> 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4642,6 +4642,9 @@
> static int evict_folios(struct lruvec *lruvec, struct scan_control
> *sc, int swap reset_batch_size(walk);
> }
>
> + __mod_lruvec_state(lruvec, PGDEMOTE_KSWAPD + reclaimer_offset(), +
> stat.nr_demoted); + item = PGSTEAL_KSWAPD + reclaimer_offset();
> if (!cgroup_reclaim(sc))
> __count_vm_events(item, reclaimed);
> --
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] mm: vmscan : pgdemote vmstat is not getting updated when MGLRU is enabled.
2025-01-09 6:05 [PATCH] mm: vmscan : pgdemote vmstat is not getting updated when MGLRU is enabled Donet Tom
2025-01-09 6:46 ` Yu Zhao
2025-01-11 2:07 ` Li Zhijian
@ 2025-01-11 2:10 ` Li Zhijian
2 siblings, 0 replies; 4+ messages in thread
From: Li Zhijian @ 2025-01-11 2:10 UTC (permalink / raw)
To: donettom
Cc: akpm, aneesh.kumar, hannes, kaiyang2, linux-kernel, linux-mm,
mhocko, muchun.song, rientjes, ritesh.list, roman.gushchin,
shakeel.butt, weixugc, yuzhao
> When MGLRU is enabled, the pgdemote_kswapd, pgdemote_direct, and
> pgdemote_khugepaged stats in vmstat are not being updated.
> 'Commit f77f0c751478 ("mm,memcg: provide per-cgroup counters for
> NUMA balancing operations")' moved the pgdemote vmstat update
> from demote_folio_list() to shrink_inactive_list(), which is in
> the normal LRU path. As a result, the pgdemote stats are updated
> correctly for the normal LRU but not for MGLRU.
> To address this, we have added the pgdemote stat update in the
> evict_folios() function, which is in the MGLRU path. With this
> patch, the pgdemote stats will now be updated correctly when MGLRU
> is enabled.
> Without this patch vmstat output when MGLRU is enabled
> ======================================================
> pgdemote_kswapd 0
> pgdemote_direct 0
> pgdemote_khugepaged 0
> With this patch vmstat output when MGLRU is enabled
> ===================================================
> pgdemote_kswapd 43234
> pgdemote_direct 4691
> pgdemote_khugepaged 0
> Fixes: f77f0c751478 ("mm,memcg: provide per-cgroup counters for NUMA balancing operations")
> Signed-off-by: Donet Tom <donettom@linux.ibm.com>
Great minds think alike, It's excatly same with mine[0] :)
There is another bug[1] as well.
[0] https://lore.kernel.org/linux-mm/20250110122133.423481-2-lizhijian@fujitsu.com/
[1] https://lore.kernel.org/linux-mm/20250110122133.423481-1-lizhijian@fujitsu.com/
Feel free to add vvv if your patch is accepted at last.
Tested-by: Li Zhijian <lizhijian@fujitsu.com>
Reviewed-by: Li Zhijian <lizhijian@fujitsu.com>
> ---
> mm/vmscan.c <https://lore.kernel.org/lkml/20250109060540.451261-1-donettom@linux.ibm.com/#Z31mm:vmscan.c> | 3 +++
> 1 filechanged <https://lore.kernel.org/lkml/20250109060540.451261-1-donettom@linux.ibm.com/#related>, 3 insertions(+)
> diff <https://lore.kernel.org/lkml/20250109060540.451261-1-donettom@linux.ibm.com/#iZ31mm:vmscan.c> --git a/mm/vmscan.c b/mm/vmscan.c index 9a859b7d18d7..b1ec5ece067e 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4642,6 +4642,9 @@ static int evict_folios(struct lruvec *lruvec, struct scan_control *sc, int swap reset_batch_size(walk);
> }
> + __mod_lruvec_state(lruvec, PGDEMOTE_KSWAPD + reclaimer_offset(), + stat.nr_demoted); + item = PGSTEAL_KSWAPD + reclaimer_offset();
> if (!cgroup_reclaim(sc))
> __count_vm_events(item, reclaimed);
> --
^ permalink raw reply [flat|nested] 4+ messages in thread