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 2/2] mm/vmscan: Fix pgdemote_* accounting with lru_gen_enabled
Date: Fri, 10 Jan 2025 20:21:33 +0800 [thread overview]
Message-ID: <20250110122133.423481-2-lizhijian@fujitsu.com> (raw)
In-Reply-To: <20250110122133.423481-1-lizhijian@fujitsu.com>
Commit f77f0c751478 ("mm,memcg: provide per-cgroup counters for NUMA balancing operations")
moved the accounting of PGDEMOTE_* statistics to shrink_inactive_list().
However, shrink_inactive_list() is not called when lrugen_enabled is true,
leading to incorrect demotion statistics despite actual demotion events
occurring.
Add the PGDEMOTE_* accounting in evict_folios(), ensuring that demotion
statistics are correctly updated regardless of the lru_gen_enabled state.
This fix is crucial for systems that rely on accurate NUMA balancing
metrics for performance tuning and resource management.
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, 2 insertions(+)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 430d580e37dd..f2d279de06c4 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -4642,6 +4642,8 @@ 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);
--
2.44.0
next prev parent 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 [PATCH 1/2] mm/vmscan: Accumulate nr_demoted for accurate demotion statistics Li Zhijian
2025-01-10 12:21 ` Li Zhijian [this message]
2025-01-15 21:51 ` [PATCH 2/2] mm/vmscan: Fix pgdemote_* accounting with lru_gen_enabled 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-2-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