blob: 7f42a3de59e6b46ff313738371439bf532a88a79 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Tejun Heoed1777d2016-08-10 11:23:44 -04002#undef TRACE_SYSTEM
3#define TRACE_SYSTEM cgroup
4
5#if !defined(_TRACE_CGROUP_H) || defined(TRACE_HEADER_MULTI_READ)
6#define _TRACE_CGROUP_H
7
8#include <linux/cgroup.h>
9#include <linux/tracepoint.h>
10
11DECLARE_EVENT_CLASS(cgroup_root,
12
13 TP_PROTO(struct cgroup_root *root),
14
15 TP_ARGS(root),
16
17 TP_STRUCT__entry(
18 __field( int, root )
19 __field( u16, ss_mask )
20 __string( name, root->name )
21 ),
22
23 TP_fast_assign(
24 __entry->root = root->hierarchy_id;
25 __entry->ss_mask = root->subsys_mask;
26 __assign_str(name, root->name);
27 ),
28
29 TP_printk("root=%d ss_mask=%#x name=%s",
30 __entry->root, __entry->ss_mask, __get_str(name))
31);
32
33DEFINE_EVENT(cgroup_root, cgroup_setup_root,
34
35 TP_PROTO(struct cgroup_root *root),
36
37 TP_ARGS(root)
38);
39
40DEFINE_EVENT(cgroup_root, cgroup_destroy_root,
41
42 TP_PROTO(struct cgroup_root *root),
43
44 TP_ARGS(root)
45);
46
47DEFINE_EVENT(cgroup_root, cgroup_remount,
48
49 TP_PROTO(struct cgroup_root *root),
50
51 TP_ARGS(root)
52);
53
54DECLARE_EVENT_CLASS(cgroup,
55
Steven Rostedt (VMware)e4f8d812018-07-09 17:48:54 -040056 TP_PROTO(struct cgroup *cgrp, const char *path),
Tejun Heoed1777d2016-08-10 11:23:44 -040057
Steven Rostedt (VMware)e4f8d812018-07-09 17:48:54 -040058 TP_ARGS(cgrp, path),
Tejun Heoed1777d2016-08-10 11:23:44 -040059
60 TP_STRUCT__entry(
61 __field( int, root )
62 __field( int, id )
63 __field( int, level )
Steven Rostedt (VMware)e4f8d812018-07-09 17:48:54 -040064 __string( path, path )
Tejun Heoed1777d2016-08-10 11:23:44 -040065 ),
66
67 TP_fast_assign(
68 __entry->root = cgrp->root->hierarchy_id;
Tejun Heo74321032019-11-04 15:54:30 -080069 __entry->id = cgroup_id(cgrp);
Tejun Heoed1777d2016-08-10 11:23:44 -040070 __entry->level = cgrp->level;
Steven Rostedt (VMware)e4f8d812018-07-09 17:48:54 -040071 __assign_str(path, path);
Tejun Heoed1777d2016-08-10 11:23:44 -040072 ),
73
74 TP_printk("root=%d id=%d level=%d path=%s",
75 __entry->root, __entry->id, __entry->level, __get_str(path))
76);
77
78DEFINE_EVENT(cgroup, cgroup_mkdir,
79
Steven Rostedt (VMware)e4f8d812018-07-09 17:48:54 -040080 TP_PROTO(struct cgroup *cgrp, const char *path),
Tejun Heoed1777d2016-08-10 11:23:44 -040081
Steven Rostedt (VMware)e4f8d812018-07-09 17:48:54 -040082 TP_ARGS(cgrp, path)
Tejun Heoed1777d2016-08-10 11:23:44 -040083);
84
85DEFINE_EVENT(cgroup, cgroup_rmdir,
86
Steven Rostedt (VMware)e4f8d812018-07-09 17:48:54 -040087 TP_PROTO(struct cgroup *cgrp, const char *path),
Tejun Heoed1777d2016-08-10 11:23:44 -040088
Steven Rostedt (VMware)e4f8d812018-07-09 17:48:54 -040089 TP_ARGS(cgrp, path)
Tejun Heoed1777d2016-08-10 11:23:44 -040090);
91
92DEFINE_EVENT(cgroup, cgroup_release,
93
Steven Rostedt (VMware)e4f8d812018-07-09 17:48:54 -040094 TP_PROTO(struct cgroup *cgrp, const char *path),
Tejun Heoed1777d2016-08-10 11:23:44 -040095
Steven Rostedt (VMware)e4f8d812018-07-09 17:48:54 -040096 TP_ARGS(cgrp, path)
Tejun Heoed1777d2016-08-10 11:23:44 -040097);
98
99DEFINE_EVENT(cgroup, cgroup_rename,
100
Steven Rostedt (VMware)e4f8d812018-07-09 17:48:54 -0400101 TP_PROTO(struct cgroup *cgrp, const char *path),
Tejun Heoed1777d2016-08-10 11:23:44 -0400102
Steven Rostedt (VMware)e4f8d812018-07-09 17:48:54 -0400103 TP_ARGS(cgrp, path)
Tejun Heoed1777d2016-08-10 11:23:44 -0400104);
105
Roman Gushchin4c476d82019-04-19 10:03:08 -0700106DEFINE_EVENT(cgroup, cgroup_freeze,
107
108 TP_PROTO(struct cgroup *cgrp, const char *path),
109
110 TP_ARGS(cgrp, path)
111);
112
113DEFINE_EVENT(cgroup, cgroup_unfreeze,
114
115 TP_PROTO(struct cgroup *cgrp, const char *path),
116
117 TP_ARGS(cgrp, path)
118);
119
Tejun Heoed1777d2016-08-10 11:23:44 -0400120DECLARE_EVENT_CLASS(cgroup_migrate,
121
Steven Rostedt (VMware)e4f8d812018-07-09 17:48:54 -0400122 TP_PROTO(struct cgroup *dst_cgrp, const char *path,
123 struct task_struct *task, bool threadgroup),
Tejun Heoed1777d2016-08-10 11:23:44 -0400124
Steven Rostedt (VMware)e4f8d812018-07-09 17:48:54 -0400125 TP_ARGS(dst_cgrp, path, task, threadgroup),
Tejun Heoed1777d2016-08-10 11:23:44 -0400126
127 TP_STRUCT__entry(
128 __field( int, dst_root )
129 __field( int, dst_id )
130 __field( int, dst_level )
Tejun Heoed1777d2016-08-10 11:23:44 -0400131 __field( int, pid )
Steven Rostedt (VMware)e4f8d812018-07-09 17:48:54 -0400132 __string( dst_path, path )
Tejun Heoed1777d2016-08-10 11:23:44 -0400133 __string( comm, task->comm )
134 ),
135
136 TP_fast_assign(
137 __entry->dst_root = dst_cgrp->root->hierarchy_id;
Tejun Heo74321032019-11-04 15:54:30 -0800138 __entry->dst_id = cgroup_id(dst_cgrp);
Tejun Heoed1777d2016-08-10 11:23:44 -0400139 __entry->dst_level = dst_cgrp->level;
Steven Rostedt (VMware)e4f8d812018-07-09 17:48:54 -0400140 __assign_str(dst_path, path);
Tejun Heoed1777d2016-08-10 11:23:44 -0400141 __entry->pid = task->pid;
142 __assign_str(comm, task->comm);
143 ),
144
145 TP_printk("dst_root=%d dst_id=%d 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))
148);
149
150DEFINE_EVENT(cgroup_migrate, cgroup_attach_task,
151
Steven Rostedt (VMware)e4f8d812018-07-09 17:48:54 -0400152 TP_PROTO(struct cgroup *dst_cgrp, const char *path,
153 struct task_struct *task, bool threadgroup),
Tejun Heoed1777d2016-08-10 11:23:44 -0400154
Steven Rostedt (VMware)e4f8d812018-07-09 17:48:54 -0400155 TP_ARGS(dst_cgrp, path, task, threadgroup)
Tejun Heoed1777d2016-08-10 11:23:44 -0400156);
157
158DEFINE_EVENT(cgroup_migrate, cgroup_transfer_tasks,
159
Steven Rostedt (VMware)e4f8d812018-07-09 17:48:54 -0400160 TP_PROTO(struct cgroup *dst_cgrp, const char *path,
161 struct task_struct *task, bool threadgroup),
Tejun Heoed1777d2016-08-10 11:23:44 -0400162
Steven Rostedt (VMware)e4f8d812018-07-09 17:48:54 -0400163 TP_ARGS(dst_cgrp, path, task, threadgroup)
Tejun Heoed1777d2016-08-10 11:23:44 -0400164);
165
Roman Gushchin4c476d82019-04-19 10:03:08 -0700166DECLARE_EVENT_CLASS(cgroup_event,
167
168 TP_PROTO(struct cgroup *cgrp, const char *path, int val),
169
170 TP_ARGS(cgrp, path, val),
171
172 TP_STRUCT__entry(
173 __field( int, root )
174 __field( int, id )
175 __field( int, level )
176 __string( path, path )
177 __field( int, val )
178 ),
179
180 TP_fast_assign(
181 __entry->root = cgrp->root->hierarchy_id;
Tejun Heo74321032019-11-04 15:54:30 -0800182 __entry->id = cgroup_id(cgrp);
Roman Gushchin4c476d82019-04-19 10:03:08 -0700183 __entry->level = cgrp->level;
184 __assign_str(path, path);
185 __entry->val = val;
186 ),
187
188 TP_printk("root=%d id=%d level=%d path=%s val=%d",
189 __entry->root, __entry->id, __entry->level, __get_str(path),
190 __entry->val)
191);
192
193DEFINE_EVENT(cgroup_event, cgroup_notify_populated,
194
195 TP_PROTO(struct cgroup *cgrp, const char *path, int val),
196
197 TP_ARGS(cgrp, path, val)
198);
199
200DEFINE_EVENT(cgroup_event, cgroup_notify_frozen,
201
202 TP_PROTO(struct cgroup *cgrp, const char *path, int val),
203
204 TP_ARGS(cgrp, path, val)
205);
206
Tejun Heoed1777d2016-08-10 11:23:44 -0400207#endif /* _TRACE_CGROUP_H */
208
209/* This part must be outside protection */
210#include <trace/define_trace.h>