linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: ratelimit stat flush from workingset shrinker
@ 2023-12-28  7:30 Shakeel Butt
  2023-12-28  8:01 ` Yu Zhao
  2023-12-28 15:13 ` Yosry Ahmed
  0 siblings, 2 replies; 4+ messages in thread
From: Shakeel Butt @ 2023-12-28  7:30 UTC (permalink / raw)
  To: Andrew Morton, Yosry Ahmed, Johannes Weiner, Yu Zhao
  Cc: linux-mm, linux-kernel, Shakeel Butt

One of our internal workload regressed on newer upstream kernel and on
further investigation, it seems like the cause is the always synchronous
rstat flush in the count_shadow_nodes() added by the commit f82e6bf9bb9b
("mm: memcg: use rstat for non-hierarchical stats"). On further
inspection it seems like we don't really need accurate stats in this
function as it was already approximating the amount of appropriate
shadow entried to keep for maintaining the refault information. Since
there is already 2 sec periodic rstat flush, we don't need exact stats
here. Let's ratelimit the rstat flush in this code path.

Fixes: f82e6bf9bb9b ("mm: memcg: use rstat for non-hierarchical stats")
Signed-off-by: Shakeel Butt <shakeelb@google.com>
---
 mm/workingset.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/workingset.c b/mm/workingset.c
index 2a2a34234df9..226012974328 100644
--- a/mm/workingset.c
+++ b/mm/workingset.c
@@ -680,7 +680,7 @@ static unsigned long count_shadow_nodes(struct shrinker *shrinker,
 		struct lruvec *lruvec;
 		int i;
 
-		mem_cgroup_flush_stats(sc->memcg);
+		mem_cgroup_flush_stats_ratelimited(sc->memcg);
 		lruvec = mem_cgroup_lruvec(sc->memcg, NODE_DATA(sc->nid));
 		for (pages = 0, i = 0; i < NR_LRU_LISTS; i++)
 			pages += lruvec_page_state_local(lruvec,
-- 
2.43.0.472.g3155946c3a-goog



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

end of thread, other threads:[~2023-12-28 17:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-28  7:30 [PATCH] mm: ratelimit stat flush from workingset shrinker Shakeel Butt
2023-12-28  8:01 ` Yu Zhao
2023-12-28 15:13 ` Yosry Ahmed
2023-12-28 17:44   ` Shakeel Butt

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