1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM memcg
5 #if !defined(_TRACE_MEMCG_H) || defined(TRACE_HEADER_MULTI_READ)
8 #include <linux/memcontrol.h>
9 #include <linux/tracepoint.h>
12 DECLARE_EVENT_CLASS(memcg_rstat_stats
,
14 TP_PROTO(struct mem_cgroup
*memcg
, int item
, int val
),
16 TP_ARGS(memcg
, item
, val
),
25 __entry
->id
= cgroup_id(memcg
->css
.cgroup
);
30 TP_printk("memcg_id=%llu item=%d val=%d",
31 __entry
->id
, __entry
->item
, __entry
->val
)
34 DEFINE_EVENT(memcg_rstat_stats
, mod_memcg_state
,
36 TP_PROTO(struct mem_cgroup
*memcg
, int item
, int val
),
38 TP_ARGS(memcg
, item
, val
)
41 DEFINE_EVENT(memcg_rstat_stats
, mod_memcg_lruvec_state
,
43 TP_PROTO(struct mem_cgroup
*memcg
, int item
, int val
),
45 TP_ARGS(memcg
, item
, val
)
48 DECLARE_EVENT_CLASS(memcg_rstat_events
,
50 TP_PROTO(struct mem_cgroup
*memcg
, int item
, unsigned long val
),
52 TP_ARGS(memcg
, item
, val
),
57 __field(unsigned long, val
)
61 __entry
->id
= cgroup_id(memcg
->css
.cgroup
);
66 TP_printk("memcg_id=%llu item=%d val=%lu",
67 __entry
->id
, __entry
->item
, __entry
->val
)
70 DEFINE_EVENT(memcg_rstat_events
, count_memcg_events
,
72 TP_PROTO(struct mem_cgroup
*memcg
, int item
, unsigned long val
),
74 TP_ARGS(memcg
, item
, val
)
77 TRACE_EVENT(memcg_flush_stats
,
79 TP_PROTO(struct mem_cgroup
*memcg
, s64 stats_updates
,
80 bool force
, bool needs_flush
),
82 TP_ARGS(memcg
, stats_updates
, force
, needs_flush
),
86 __field(s64
, stats_updates
)
88 __field(bool, needs_flush
)
92 __entry
->id
= cgroup_id(memcg
->css
.cgroup
);
93 __entry
->stats_updates
= stats_updates
;
94 __entry
->force
= force
;
95 __entry
->needs_flush
= needs_flush
;
98 TP_printk("memcg_id=%llu stats_updates=%lld force=%d needs_flush=%d",
99 __entry
->id
, __entry
->stats_updates
,
100 __entry
->force
, __entry
->needs_flush
)
103 #endif /* _TRACE_MEMCG_H */
105 /* This part must be outside protection */
106 #include <trace/define_trace.h>