linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mm/vmscan: Accumulate nr_demoted for accurate demotion statistics
@ 2025-01-10 12:21 Li Zhijian
  2025-01-10 12:21 ` [PATCH 2/2] mm/vmscan: Fix pgdemote_* accounting with lru_gen_enabled Li Zhijian
  2025-01-10 12:49 ` [PATCH 1/2] mm/vmscan: Accumulate nr_demoted for accurate demotion statistics Kaiyang Zhao
  0 siblings, 2 replies; 7+ messages in thread
From: Li Zhijian @ 2025-01-10 12:21 UTC (permalink / raw)
  To: linux-mm; +Cc: Kaiyang Zhao, Andrew Morton, linux-kernel, Li Zhijian

In the shrink_folio_list() function, demote_folio_list() can be called
multiple times, which can lead to inaccurate demotion statistics if the
number of demoted pages is not accumulated correctly.

Accumulate the nr_demoted count across multiple calls to
demote_folio_list(), ensuring accurate reporting of demotion statistics.

Fixes: f77f0c751478 ("mm,memcg: provide per-cgroup counters for NUMA balancing operations")
Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
---
 mm/vmscan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 9a859b7d18d7..430d580e37dd 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1522,7 +1522,7 @@ static unsigned int shrink_folio_list(struct list_head *folio_list,
 	/* 'folio_list' is always empty here */
 
 	/* Migrate folios selected for demotion */
-	stat->nr_demoted = demote_folio_list(&demote_folios, pgdat);
+	stat->nr_demoted += demote_folio_list(&demote_folios, pgdat);
 	nr_reclaimed += stat->nr_demoted;
 	/* Folios that could not be demoted are still in @demote_folios */
 	if (!list_empty(&demote_folios)) {
-- 
2.44.0



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

end of thread, other threads:[~2025-01-15 21:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-10 12:21 [PATCH 1/2] mm/vmscan: Accumulate nr_demoted for accurate demotion statistics Li Zhijian
2025-01-10 12:21 ` [PATCH 2/2] mm/vmscan: Fix pgdemote_* accounting with lru_gen_enabled Li Zhijian
2025-01-15 21:51   ` Yu Zhao
2025-01-10 12:49 ` [PATCH 1/2] mm/vmscan: Accumulate nr_demoted for accurate demotion statistics Kaiyang Zhao
2025-01-10 14:19   ` Zhijian Li (Fujitsu)
2025-01-10 14:24     ` Zhijian Li (Fujitsu)
2025-01-10 15:24       ` Kaiyang Zhao

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