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