Loading...
1/* SPDX-License-Identifier: GPL-2.0 */
2#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
56 TP_PROTO(struct cgroup *cgrp, const char *path),
57
58 TP_ARGS(cgrp, path),
59
60 TP_STRUCT__entry(
61 __field( int, root )
62 __field( int, level )
63 __field( u64, id )
64 __string( path, path )
65 ),
66
67 TP_fast_assign(
68 __entry->root = cgrp->root->hierarchy_id;
69 __entry->id = cgroup_id(cgrp);
70 __entry->level = cgrp->level;
71 __assign_str(path, path);
72 ),
73
74 TP_printk("root=%d id=%llu level=%d path=%s",
75 __entry->root, __entry->id, __entry->level, __get_str(path))
76);
77
78DEFINE_EVENT(cgroup, cgroup_mkdir,
79
80 TP_PROTO(struct cgroup *cgrp, const char *path),
81
82 TP_ARGS(cgrp, path)
83);
84
85DEFINE_EVENT(cgroup, cgroup_rmdir,
86
87 TP_PROTO(struct cgroup *cgrp, const char *path),
88
89 TP_ARGS(cgrp, path)
90);
91
92DEFINE_EVENT(cgroup, cgroup_release,
93
94 TP_PROTO(struct cgroup *cgrp, const char *path),
95
96 TP_ARGS(cgrp, path)
97);
98
99DEFINE_EVENT(cgroup, cgroup_rename,
100
101 TP_PROTO(struct cgroup *cgrp, const char *path),
102
103 TP_ARGS(cgrp, path)
104);
105
106DEFINE_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
120DECLARE_EVENT_CLASS(cgroup_migrate,
121
122 TP_PROTO(struct cgroup *dst_cgrp, const char *path,
123 struct task_struct *task, bool threadgroup),
124
125 TP_ARGS(dst_cgrp, path, task, threadgroup),
126
127 TP_STRUCT__entry(
128 __field( int, dst_root )
129 __field( int, dst_level )
130 __field( u64, dst_id )
131 __field( int, pid )
132 __string( dst_path, path )
133 __string( comm, task->comm )
134 ),
135
136 TP_fast_assign(
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, path);
141 __entry->pid = task->pid;
142 __assign_str(comm, task->comm);
143 ),
144
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))
148);
149
150DEFINE_EVENT(cgroup_migrate, cgroup_attach_task,
151
152 TP_PROTO(struct cgroup *dst_cgrp, const char *path,
153 struct task_struct *task, bool threadgroup),
154
155 TP_ARGS(dst_cgrp, path, task, threadgroup)
156);
157
158DEFINE_EVENT(cgroup_migrate, cgroup_transfer_tasks,
159
160 TP_PROTO(struct cgroup *dst_cgrp, const char *path,
161 struct task_struct *task, bool threadgroup),
162
163 TP_ARGS(dst_cgrp, path, task, threadgroup)
164);
165
166DECLARE_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, level )
175 __field( u64, id )
176 __string( path, path )
177 __field( int, val )
178 ),
179
180 TP_fast_assign(
181 __entry->root = cgrp->root->hierarchy_id;
182 __entry->id = cgroup_id(cgrp);
183 __entry->level = cgrp->level;
184 __assign_str(path, path);
185 __entry->val = val;
186 ),
187
188 TP_printk("root=%d id=%llu 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
207#endif /* _TRACE_CGROUP_H */
208
209/* This part must be outside protection */
210#include <trace/define_trace.h>
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM cgroup
3
4#if !defined(_TRACE_CGROUP_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_CGROUP_H
6
7#include <linux/cgroup.h>
8#include <linux/tracepoint.h>
9
10DECLARE_EVENT_CLASS(cgroup_root,
11
12 TP_PROTO(struct cgroup_root *root),
13
14 TP_ARGS(root),
15
16 TP_STRUCT__entry(
17 __field( int, root )
18 __field( u16, ss_mask )
19 __string( name, root->name )
20 ),
21
22 TP_fast_assign(
23 __entry->root = root->hierarchy_id;
24 __entry->ss_mask = root->subsys_mask;
25 __assign_str(name, root->name);
26 ),
27
28 TP_printk("root=%d ss_mask=%#x name=%s",
29 __entry->root, __entry->ss_mask, __get_str(name))
30);
31
32DEFINE_EVENT(cgroup_root, cgroup_setup_root,
33
34 TP_PROTO(struct cgroup_root *root),
35
36 TP_ARGS(root)
37);
38
39DEFINE_EVENT(cgroup_root, cgroup_destroy_root,
40
41 TP_PROTO(struct cgroup_root *root),
42
43 TP_ARGS(root)
44);
45
46DEFINE_EVENT(cgroup_root, cgroup_remount,
47
48 TP_PROTO(struct cgroup_root *root),
49
50 TP_ARGS(root)
51);
52
53DECLARE_EVENT_CLASS(cgroup,
54
55 TP_PROTO(struct cgroup *cgrp),
56
57 TP_ARGS(cgrp),
58
59 TP_STRUCT__entry(
60 __field( int, root )
61 __field( int, id )
62 __field( int, level )
63 __dynamic_array(char, path,
64 cgrp->kn ? cgroup_path(cgrp, NULL, 0) + 1
65 : strlen("(null)"))
66 ),
67
68 TP_fast_assign(
69 __entry->root = cgrp->root->hierarchy_id;
70 __entry->id = cgrp->id;
71 __entry->level = cgrp->level;
72 if (cgrp->kn)
73 cgroup_path(cgrp, __get_dynamic_array(path),
74 __get_dynamic_array_len(path));
75 else
76 __assign_str(path, "(null)");
77 ),
78
79 TP_printk("root=%d id=%d level=%d path=%s",
80 __entry->root, __entry->id, __entry->level, __get_str(path))
81);
82
83DEFINE_EVENT(cgroup, cgroup_mkdir,
84
85 TP_PROTO(struct cgroup *cgroup),
86
87 TP_ARGS(cgroup)
88);
89
90DEFINE_EVENT(cgroup, cgroup_rmdir,
91
92 TP_PROTO(struct cgroup *cgroup),
93
94 TP_ARGS(cgroup)
95);
96
97DEFINE_EVENT(cgroup, cgroup_release,
98
99 TP_PROTO(struct cgroup *cgroup),
100
101 TP_ARGS(cgroup)
102);
103
104DEFINE_EVENT(cgroup, cgroup_rename,
105
106 TP_PROTO(struct cgroup *cgroup),
107
108 TP_ARGS(cgroup)
109);
110
111DECLARE_EVENT_CLASS(cgroup_migrate,
112
113 TP_PROTO(struct cgroup *dst_cgrp, struct task_struct *task, bool threadgroup),
114
115 TP_ARGS(dst_cgrp, task, threadgroup),
116
117 TP_STRUCT__entry(
118 __field( int, dst_root )
119 __field( int, dst_id )
120 __field( int, dst_level )
121 __dynamic_array(char, dst_path,
122 dst_cgrp->kn ? cgroup_path(dst_cgrp, NULL, 0) + 1
123 : strlen("(null)"))
124 __field( int, pid )
125 __string( comm, task->comm )
126 ),
127
128 TP_fast_assign(
129 __entry->dst_root = dst_cgrp->root->hierarchy_id;
130 __entry->dst_id = dst_cgrp->id;
131 __entry->dst_level = dst_cgrp->level;
132 if (dst_cgrp->kn)
133 cgroup_path(dst_cgrp, __get_dynamic_array(dst_path),
134 __get_dynamic_array_len(dst_path));
135 else
136 __assign_str(dst_path, "(null)");
137 __entry->pid = task->pid;
138 __assign_str(comm, task->comm);
139 ),
140
141 TP_printk("dst_root=%d dst_id=%d dst_level=%d dst_path=%s pid=%d comm=%s",
142 __entry->dst_root, __entry->dst_id, __entry->dst_level,
143 __get_str(dst_path), __entry->pid, __get_str(comm))
144);
145
146DEFINE_EVENT(cgroup_migrate, cgroup_attach_task,
147
148 TP_PROTO(struct cgroup *dst_cgrp, struct task_struct *task, bool threadgroup),
149
150 TP_ARGS(dst_cgrp, task, threadgroup)
151);
152
153DEFINE_EVENT(cgroup_migrate, cgroup_transfer_tasks,
154
155 TP_PROTO(struct cgroup *dst_cgrp, struct task_struct *task, bool threadgroup),
156
157 TP_ARGS(dst_cgrp, task, threadgroup)
158);
159
160#endif /* _TRACE_CGROUP_H */
161
162/* This part must be outside protection */
163#include <trace/define_trace.h>