1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #undef TRACE_SYSTEM 3 #define TRACE_SYSTEM memcg 4 5 #if !defined(_TRACE_MEMCG_H) || defined(TRACE_HEADER_MULTI_READ) 6 #define _TRACE_MEMCG_H 7 8 #include <linux/memcontrol.h> 9 #include <linux/tracepoint.h> 10 11 12 DECLARE_EVENT_CLASS(memcg_rstat_stats, 13 14 TP_PROTO(struct mem_cgroup *memcg, int item, int val), 15 16 TP_ARGS(memcg, item, val), 17 18 TP_STRUCT__entry( 19 __field(u64, id) 20 __field(int, item) 21 __field(int, val) 22 ), 23 24 TP_fast_assign( 25 __entry->id = cgroup_id(memcg->css.cgroup); 26 __entry->item = item; 27 __entry->val = val; 28 ), 29 30 TP_printk("memcg_id=%llu item=%d val=%d", 31 __entry->id, __entry->item, __entry->val) 32 ); 33 34 DEFINE_EVENT(memcg_rstat_stats, mod_memcg_state, 35 36 TP_PROTO(struct mem_cgroup *memcg, int item, int val), 37 38 TP_ARGS(memcg, item, val) 39 ); 40 41 DEFINE_EVENT(memcg_rstat_stats, mod_memcg_lruvec_state, 42 43 TP_PROTO(struct mem_cgroup *memcg, int item, int val), 44 45 TP_ARGS(memcg, item, val) 46 ); 47 48 DECLARE_EVENT_CLASS(memcg_rstat_events, 49 50 TP_PROTO(struct mem_cgroup *memcg, int item, unsigned long val), 51 52 TP_ARGS(memcg, item, val), 53 54 TP_STRUCT__entry( 55 __field(u64, id) 56 __field(int, item) 57 __field(unsigned long, val) 58 ), 59 60 TP_fast_assign( 61 __entry->id = cgroup_id(memcg->css.cgroup); 62 __entry->item = item; 63 __entry->val = val; 64 ), 65 66 TP_printk("memcg_id=%llu item=%d val=%lu", 67 __entry->id, __entry->item, __entry->val) 68 ); 69 70 DEFINE_EVENT(memcg_rstat_events, count_memcg_events, 71 72 TP_PROTO(struct mem_cgroup *memcg, int item, unsigned long val), 73 74 TP_ARGS(memcg, item, val) 75 ); 76 77 TRACE_EVENT(memcg_flush_stats, 78 79 TP_PROTO(struct mem_cgroup *memcg, s64 stats_updates, 80 bool force, bool needs_flush), 81 82 TP_ARGS(memcg, stats_updates, force, needs_flush), 83 84 TP_STRUCT__entry( 85 __field(u64, id) 86 __field(s64, stats_updates) 87 __field(bool, force) 88 __field(bool, needs_flush) 89 ), 90 91 TP_fast_assign( 92 __entry->id = cgroup_id(memcg->css.cgroup); 93 __entry->stats_updates = stats_updates; 94 __entry->force = force; 95 __entry->needs_flush = needs_flush; 96 ), 97 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) 101 ); 102 103 #endif /* _TRACE_MEMCG_H */ 104 105 /* This part must be outside protection */ 106 #include <trace/define_trace.h> 107