mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-15 01:24:33 +00:00
f914ac96ee
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>
107 lines
2.2 KiB
C
107 lines
2.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#undef TRACE_SYSTEM
|
|
#define TRACE_SYSTEM memcg
|
|
|
|
#if !defined(_TRACE_MEMCG_H) || defined(TRACE_HEADER_MULTI_READ)
|
|
#define _TRACE_MEMCG_H
|
|
|
|
#include <linux/memcontrol.h>
|
|
#include <linux/tracepoint.h>
|
|
|
|
|
|
DECLARE_EVENT_CLASS(memcg_rstat_stats,
|
|
|
|
TP_PROTO(struct mem_cgroup *memcg, int item, int val),
|
|
|
|
TP_ARGS(memcg, item, val),
|
|
|
|
TP_STRUCT__entry(
|
|
__field(u64, id)
|
|
__field(int, item)
|
|
__field(int, val)
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__entry->id = cgroup_id(memcg->css.cgroup);
|
|
__entry->item = item;
|
|
__entry->val = val;
|
|
),
|
|
|
|
TP_printk("memcg_id=%llu item=%d val=%d",
|
|
__entry->id, __entry->item, __entry->val)
|
|
);
|
|
|
|
DEFINE_EVENT(memcg_rstat_stats, mod_memcg_state,
|
|
|
|
TP_PROTO(struct mem_cgroup *memcg, int item, int val),
|
|
|
|
TP_ARGS(memcg, item, val)
|
|
);
|
|
|
|
DEFINE_EVENT(memcg_rstat_stats, mod_memcg_lruvec_state,
|
|
|
|
TP_PROTO(struct mem_cgroup *memcg, int item, int val),
|
|
|
|
TP_ARGS(memcg, item, val)
|
|
);
|
|
|
|
DECLARE_EVENT_CLASS(memcg_rstat_events,
|
|
|
|
TP_PROTO(struct mem_cgroup *memcg, int item, unsigned long val),
|
|
|
|
TP_ARGS(memcg, item, val),
|
|
|
|
TP_STRUCT__entry(
|
|
__field(u64, id)
|
|
__field(int, item)
|
|
__field(unsigned long, val)
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__entry->id = cgroup_id(memcg->css.cgroup);
|
|
__entry->item = item;
|
|
__entry->val = val;
|
|
),
|
|
|
|
TP_printk("memcg_id=%llu item=%d val=%lu",
|
|
__entry->id, __entry->item, __entry->val)
|
|
);
|
|
|
|
DEFINE_EVENT(memcg_rstat_events, count_memcg_events,
|
|
|
|
TP_PROTO(struct mem_cgroup *memcg, int item, unsigned long val),
|
|
|
|
TP_ARGS(memcg, item, val)
|
|
);
|
|
|
|
TRACE_EVENT(memcg_flush_stats,
|
|
|
|
TP_PROTO(struct mem_cgroup *memcg, s64 stats_updates,
|
|
bool force, bool needs_flush),
|
|
|
|
TP_ARGS(memcg, stats_updates, force, needs_flush),
|
|
|
|
TP_STRUCT__entry(
|
|
__field(u64, id)
|
|
__field(s64, stats_updates)
|
|
__field(bool, force)
|
|
__field(bool, needs_flush)
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__entry->id = cgroup_id(memcg->css.cgroup);
|
|
__entry->stats_updates = stats_updates;
|
|
__entry->force = force;
|
|
__entry->needs_flush = needs_flush;
|
|
),
|
|
|
|
TP_printk("memcg_id=%llu stats_updates=%lld force=%d needs_flush=%d",
|
|
__entry->id, __entry->stats_updates,
|
|
__entry->force, __entry->needs_flush)
|
|
);
|
|
|
|
#endif /* _TRACE_MEMCG_H */
|
|
|
|
/* This part must be outside protection */
|
|
#include <trace/define_trace.h>
|