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;
26 __assign_str(name, root->name);
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 = cgrp->id;
70 __entry->level = cgrp->level;
71 __assign_str(path, path);
74 TP_printk("root=%d id=%d 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 DECLARE_EVENT_CLASS(cgroup_migrate,
108 TP_PROTO(struct cgroup *dst_cgrp, const char *path,
109 struct task_struct *task, bool threadgroup),
111 TP_ARGS(dst_cgrp, path, task, threadgroup),
114 __field( int, dst_root )
115 __field( int, dst_id )
116 __field( int, dst_level )
118 __string( dst_path, path )
119 __string( comm, task->comm )
123 __entry->dst_root = dst_cgrp->root->hierarchy_id;
124 __entry->dst_id = dst_cgrp->id;
125 __entry->dst_level = dst_cgrp->level;
126 __assign_str(dst_path, path);
127 __entry->pid = task->pid;
128 __assign_str(comm, task->comm);
131 TP_printk("dst_root=%d dst_id=%d dst_level=%d dst_path=%s pid=%d comm=%s",
132 __entry->dst_root, __entry->dst_id, __entry->dst_level,
133 __get_str(dst_path), __entry->pid, __get_str(comm))
136 DEFINE_EVENT(cgroup_migrate, cgroup_attach_task,
138 TP_PROTO(struct cgroup *dst_cgrp, const char *path,
139 struct task_struct *task, bool threadgroup),
141 TP_ARGS(dst_cgrp, path, task, threadgroup)
144 DEFINE_EVENT(cgroup_migrate, cgroup_transfer_tasks,
146 TP_PROTO(struct cgroup *dst_cgrp, const char *path,
147 struct task_struct *task, bool threadgroup),
149 TP_ARGS(dst_cgrp, path, task, threadgroup)
152 #endif /* _TRACE_CGROUP_H */
154 /* This part must be outside protection */
155 #include <trace/define_trace.h>