summaryrefslogtreecommitdiff
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
authorJP Kobryn <inwardvessel@gmail.com>2024-10-28 19:11:06 -0700
committerAndrew Morton <akpm@linux-foundation.org>2024-11-11 00:26:46 -0800
commitf914ac96ee8828368f5a24553e75216d76da0b42 (patch)
treedc1106f7e99879a30f1f63f95c41a6b4fdea0970 /mm/memcontrol.c
parente1479b880cb213057c48dc8b5fb1a8a64e04f0eb (diff)
memcg: add flush tracepoint
This tracepoint gives visibility on how often the flushing of memcg stats occurs and contains info on whether it was forced, skipped, and the value of stats updated. It can help with understanding how readers are affected by having to perform the flush, and the effectiveness of the flush by inspecting the number of stats updated. Paired with the recently added tracepoints for tracing rstat updates, it can also help show correlation where stats exceed thresholds frequently. Link: https://lkml.kernel.org/r/20241029021106.25587-3-inwardvessel@gmail.com Signed-off-by: JP Kobryn <inwardvessel@gmail.com> Reviewed-by: Yosry Ahmed <yosryahmed@google.com> Acked-by: Shakeel Butt <shakeel.butt@linux.dev> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Steven Rostedt (Google) <rostedt@goodmis.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r--mm/memcontrol.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index a4da834b4aa3..6486e9652843 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -597,7 +597,12 @@ static inline void memcg_rstat_updated(struct mem_cgroup *memcg, int val)
static void __mem_cgroup_flush_stats(struct mem_cgroup *memcg, bool force)
{
- if (!force && !memcg_vmstats_needs_flush(memcg->vmstats))
+ bool needs_flush = memcg_vmstats_needs_flush(memcg->vmstats);
+
+ trace_memcg_flush_stats(memcg, atomic64_read(&memcg->vmstats->stats_updates),
+ force, needs_flush);
+
+ if (!force && !needs_flush)
return;
if (mem_cgroup_is_root(memcg))