mm: vmscan : pgdemote vmstat is not getting updated when MGLRU is enabled.
Subsystems (3)
PATCH 1/1 mm: vmscan : pgdemote vmstat is not getting updated when MGLRU is enabled.
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 0pgdemote_direct 0pgdemote_khugepaged 0
With this patch vmstat output when MGLRU is enabled
===================================================pgdemote_kswapd 43234pgdemote_direct 4691pgdemote_khugepaged 0
--- mm/vmscan.c | 3 +++ 1 file changed, 3 insertions(+)
mm/vmscan.c +3 -0
@@ -4642,6 +4642,9 @@ static int evict_folios(struct lruvec *lruvec, struct scan_control *sc, int swapreset_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);
Signature · 1 line
2.43.5
Quoted 21 lines · Donet Tom
When MGLRU is enabled, the
pgdemote_kswapd,pgdemote_direct, andpgdemote_khugepagedstats in vmstat are not being updated.'Commit
f77f0c751478("mm,memcg: provide per-cgroup counters for NUMA balancing operations")' moved the pgdemote vmstat update fromdemote_folio_list()toshrink_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_kswapd0pgdemote_direct0pgdemote_khugepaged0
Quoted 8 lines
With this patch vmstat output when MGLRU is enabled
===================================================pgdemote_kswapd43234pgdemote_direct4691pgdemote_khugepaged0Fixes f77f0c751478 ("mm,memcg: provide per-cgroup counters for NUMA balancing operations")Signed-off-by Donet Tom <[email protected]>
Quoted 20 lines
When MGLRU is enabled, the
pgdemote_kswapd,pgdemote_direct, andpgdemote_khugepagedstats in vmstat are not being updated.'Commit
f77f0c751478("mm,memcg: provide per-cgroup counters for NUMA balancing operations")' moved the pgdemote vmstat update fromdemote_folio_list()toshrink_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_kswapd0pgdemote_direct0pgdemote_khugepaged0
Quoted 8 lines
With this patch vmstat output when MGLRU is enabled
===================================================pgdemote_kswapd43234pgdemote_direct4691pgdemote_khugepaged0Fixes f77f0c751478 ("mm,memcg: provide per-cgroup counters for NUMA balancing operations")Signed-off-by Donet Tom <[email protected]>
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/[email protected]/ [1] https://lore.kernel.org/linux-mm/[email protected]/
Feel free to add vvv if your patch is accepted at last.
Quoted 14 lines
--- mm/vmscan.c <https://lore.kernel.org/lkml/[email protected]/#Z31mm:vmscan.c> | 3 +++1 filechanged <https://lore.kernel.org/lkml/[email protected]/#related>, 3 insertions(+)
diff <https://lore.kernel.org/lkml/[email protected]/#iZ31mm:vmscan.c>
--gita/mm/vmscan.cb/mm/vmscan.cindex9a859b7d18d7..b1ec5ece067e
100644 ---a/mm/vmscan.c+++b/mm/vmscan.c@@ -4642,6 +4642,9 @@ static int evict_folios(struct lruvec *lruvec, structscan_control*sc, int swapreset_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);
Quoted 21 lines
When MGLRU is enabled, the
pgdemote_kswapd,pgdemote_direct, andpgdemote_khugepagedstats in vmstat are not being updated. 'Commitf77f0c751478("mm,memcg: provide per-cgroup counters for NUMA balancing operations")' moved the pgdemote vmstat update fromdemote_folio_list()toshrink_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 theevict_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_kswapd0pgdemote_direct0pgdemote_khugepaged0
With this patch vmstat output when MGLRU is enabled
===================================================pgdemote_kswapd43234pgdemote_direct4691pgdemote_khugepaged0
Quoted 2 lines
Fixes f77f0c751478 ("mm,memcg: provide per-cgroup counters for NUMA balancing operations")Signed-off-by Donet Tom <[email protected]>
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/[email protected]/
[1] https://lore.kernel.org/linux-mm/[email protected]/
Feel free to add vvv if your patch is accepted at last.
Quoted 9 lines
--- mm/vmscan.c <https://lore.kernel.org/lkml/[email protected]/#Z31mm:vmscan.c> | 3 +++ 1 filechanged <https://lore.kernel.org/lkml/[email protected]/#related>, 3 insertions(+) diff <https://lore.kernel.org/lkml/[email protected]/#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);