1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM cgroup
5 #if !defined(_TRACE_CGROUP_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_CGROUP_H
8 #include <linux/cgroup.h>
9 #include <linux/tracepoint.h>
11 DECLARE_EVENT_CLASS(cgroup_root
,
13 TP_PROTO(struct cgroup_root
*root
),
19 __field( u16
, ss_mask
)
20 __string( name
, root
->name
)
24 __entry
->root
= root
->hierarchy_id
;
25 __entry
->ss_mask
= root
->subsys_mask
;
29 TP_printk("root=%d ss_mask=%#x name=%s",
30 __entry
->root
, __entry
->ss_mask
, __get_str(name
))
33 DEFINE_EVENT(cgroup_root
, cgroup_setup_root
,
35 TP_PROTO(struct cgroup_root
*root
),
40 DEFINE_EVENT(cgroup_root
, cgroup_destroy_root
,
42 TP_PROTO(struct cgroup_root
*root
),
47 DEFINE_EVENT(cgroup_root
, cgroup_remount
,
49 TP_PROTO(struct cgroup_root
*root
),
54 DECLARE_EVENT_CLASS(cgroup
,
56 TP_PROTO(struct cgroup
*cgrp
, const char *path
),
64 __string( path
, path
)
68 __entry
->root
= cgrp
->root
->hierarchy_id
;
69 __entry
->id
= cgroup_id(cgrp
);
70 __entry
->level
= cgrp
->level
;
74 TP_printk("root=%d id=%llu level=%d path=%s",
75 __entry
->root
, __entry
->id
, __entry
->level
, __get_str(path
))
78 DEFINE_EVENT(cgroup
, cgroup_mkdir
,
80 TP_PROTO(struct cgroup
*cgrp
, const char *path
),
85 DEFINE_EVENT(cgroup
, cgroup_rmdir
,
87 TP_PROTO(struct cgroup
*cgrp
, const char *path
),
92 DEFINE_EVENT(cgroup
, cgroup_release
,
94 TP_PROTO(struct cgroup
*cgrp
, const char *path
),
99 DEFINE_EVENT(cgroup
, cgroup_rename
,
101 TP_PROTO(struct cgroup
*cgrp
, const char *path
),
106 DEFINE_EVENT(cgroup
, cgroup_freeze
,
108 TP_PROTO(struct cgroup
*cgrp
, const char *path
),
113 DEFINE_EVENT(cgroup
, cgroup_unfreeze
,
115 TP_PROTO(struct cgroup
*cgrp
, const char *path
),
120 DECLARE_EVENT_CLASS(cgroup_migrate
,
122 TP_PROTO(struct cgroup
*dst_cgrp
, const char *path
,
123 struct task_struct
*task
, bool threadgroup
),
125 TP_ARGS(dst_cgrp
, path
, task
, threadgroup
),
128 __field( int, dst_root
)
129 __field( int, dst_level
)
130 __field( u64
, dst_id
)
132 __string( dst_path
, path
)
133 __string( comm
, task
->comm
)
137 __entry
->dst_root
= dst_cgrp
->root
->hierarchy_id
;
138 __entry
->dst_id
= cgroup_id(dst_cgrp
);
139 __entry
->dst_level
= dst_cgrp
->level
;
140 __assign_str(dst_path
);
141 __entry
->pid
= task
->pid
;
145 TP_printk("dst_root=%d dst_id=%llu dst_level=%d dst_path=%s pid=%d comm=%s",
146 __entry
->dst_root
, __entry
->dst_id
, __entry
->dst_level
,
147 __get_str(dst_path
), __entry
->pid
, __get_str(comm
))
150 DEFINE_EVENT(cgroup_migrate
, cgroup_attach_task
,
152 TP_PROTO(struct cgroup
*dst_cgrp
, const char *path
,
153 struct task_struct
*task
, bool threadgroup
),
155 TP_ARGS(dst_cgrp
, path
, task
, threadgroup
)
158 DEFINE_EVENT(cgroup_migrate
, cgroup_transfer_tasks
,
160 TP_PROTO(struct cgroup
*dst_cgrp
, const char *path
,
161 struct task_struct
*task
, bool threadgroup
),
163 TP_ARGS(dst_cgrp
, path
, task
, threadgroup
)
166 DECLARE_EVENT_CLASS(cgroup_event
,
168 TP_PROTO(struct cgroup
*cgrp
, const char *path
, int val
),
170 TP_ARGS(cgrp
, path
, val
),
174 __field( int, level
)
176 __string( path
, path
)
181 __entry
->root
= cgrp
->root
->hierarchy_id
;
182 __entry
->id
= cgroup_id(cgrp
);
183 __entry
->level
= cgrp
->level
;
188 TP_printk("root=%d id=%llu level=%d path=%s val=%d",
189 __entry
->root
, __entry
->id
, __entry
->level
, __get_str(path
),
193 DEFINE_EVENT(cgroup_event
, cgroup_notify_populated
,
195 TP_PROTO(struct cgroup
*cgrp
, const char *path
, int val
),
197 TP_ARGS(cgrp
, path
, val
)
200 DEFINE_EVENT(cgroup_event
, cgroup_notify_frozen
,
202 TP_PROTO(struct cgroup
*cgrp
, const char *path
, int val
),
204 TP_ARGS(cgrp
, path
, val
)
207 DECLARE_EVENT_CLASS(cgroup_rstat
,
209 TP_PROTO(struct cgroup
*cgrp
, int cpu
, bool contended
),
211 TP_ARGS(cgrp
, cpu
, contended
),
215 __field( int, level
)
218 __field( bool, contended
)
222 __entry
->root
= cgrp
->root
->hierarchy_id
;
223 __entry
->id
= cgroup_id(cgrp
);
224 __entry
->level
= cgrp
->level
;
226 __entry
->contended
= contended
;
229 TP_printk("root=%d id=%llu level=%d cpu=%d lock contended:%d",
230 __entry
->root
, __entry
->id
, __entry
->level
,
231 __entry
->cpu
, __entry
->contended
)
234 /* Related to global: cgroup_rstat_lock */
235 DEFINE_EVENT(cgroup_rstat
, cgroup_rstat_lock_contended
,
237 TP_PROTO(struct cgroup
*cgrp
, int cpu
, bool contended
),
239 TP_ARGS(cgrp
, cpu
, contended
)
242 DEFINE_EVENT(cgroup_rstat
, cgroup_rstat_locked
,
244 TP_PROTO(struct cgroup
*cgrp
, int cpu
, bool contended
),
246 TP_ARGS(cgrp
, cpu
, contended
)
249 DEFINE_EVENT(cgroup_rstat
, cgroup_rstat_unlock
,
251 TP_PROTO(struct cgroup
*cgrp
, int cpu
, bool contended
),
253 TP_ARGS(cgrp
, cpu
, contended
)
256 /* Related to per CPU: cgroup_rstat_cpu_lock */
257 DEFINE_EVENT(cgroup_rstat
, cgroup_rstat_cpu_lock_contended
,
259 TP_PROTO(struct cgroup
*cgrp
, int cpu
, bool contended
),
261 TP_ARGS(cgrp
, cpu
, contended
)
264 DEFINE_EVENT(cgroup_rstat
, cgroup_rstat_cpu_lock_contended_fastpath
,
266 TP_PROTO(struct cgroup
*cgrp
, int cpu
, bool contended
),
268 TP_ARGS(cgrp
, cpu
, contended
)
271 DEFINE_EVENT(cgroup_rstat
, cgroup_rstat_cpu_locked
,
273 TP_PROTO(struct cgroup
*cgrp
, int cpu
, bool contended
),
275 TP_ARGS(cgrp
, cpu
, contended
)
278 DEFINE_EVENT(cgroup_rstat
, cgroup_rstat_cpu_locked_fastpath
,
280 TP_PROTO(struct cgroup
*cgrp
, int cpu
, bool contended
),
282 TP_ARGS(cgrp
, cpu
, contended
)
285 DEFINE_EVENT(cgroup_rstat
, cgroup_rstat_cpu_unlock
,
287 TP_PROTO(struct cgroup
*cgrp
, int cpu
, bool contended
),
289 TP_ARGS(cgrp
, cpu
, contended
)
292 DEFINE_EVENT(cgroup_rstat
, cgroup_rstat_cpu_unlock_fastpath
,
294 TP_PROTO(struct cgroup
*cgrp
, int cpu
, bool contended
),
296 TP_ARGS(cgrp
, cpu
, contended
)
299 #endif /* _TRACE_CGROUP_H */
301 /* This part must be outside protection */
302 #include <trace/define_trace.h>