From: Li Zhijian <lizhijian@fujitsu.com>
To: linux-mm@kvack.org
Cc: Kaiyang Zhao <kaiyang2@cs.cmu.edu>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, Li Zhijian <lizhijian@fujitsu.com>
Subject: [PATCH 1/2] mm/vmscan: Accumulate nr_demoted for accurate demotion statistics
Date: Fri, 10 Jan 2025 20:21:32 +0800 [thread overview]
Message-ID: <20250110122133.423481-1-lizhijian@fujitsu.com> (raw)
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
next reply other threads:[~2025-01-10 12:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-10 12:21 Li Zhijian [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250110122133.423481-1-lizhijian@fujitsu.com \
--to=lizhijian@fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=kaiyang2@cs.cmu.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox