[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250110122133.423481-1-lizhijian@fujitsu.com>
Date: Fri, 10 Jan 2025 20:21:32 +0800
From: Li Zhijian <lizhijian@...itsu.com>
To: linux-mm@...ck.org
Cc: Kaiyang Zhao <kaiyang2@...cmu.edu>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org,
Li Zhijian <lizhijian@...itsu.com>
Subject: [PATCH 1/2] mm/vmscan: Accumulate nr_demoted for accurate demotion statistics
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@...itsu.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
Powered by blists - more mailing lists