1b2441318SGreg 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 56e4f8d81cSSteven Rostedt (VMware) TP_PROTO(struct cgroup *cgrp, const char *path), 57ed1777deSTejun Heo 58e4f8d81cSSteven Rostedt (VMware) TP_ARGS(cgrp, path), 59ed1777deSTejun Heo 60ed1777deSTejun Heo TP_STRUCT__entry( 61ed1777deSTejun Heo __field( int, root ) 62ed1777deSTejun Heo __field( int, id ) 63ed1777deSTejun Heo __field( int, level ) 64e4f8d81cSSteven Rostedt (VMware) __string( path, path ) 65ed1777deSTejun Heo ), 66ed1777deSTejun Heo 67ed1777deSTejun Heo TP_fast_assign( 68ed1777deSTejun Heo __entry->root = cgrp->root->hierarchy_id; 69ed1777deSTejun Heo __entry->id = cgrp->id; 70ed1777deSTejun Heo __entry->level = cgrp->level; 71e4f8d81cSSteven Rostedt (VMware) __assign_str(path, path); 72ed1777deSTejun Heo ), 73ed1777deSTejun Heo 74ed1777deSTejun Heo TP_printk("root=%d id=%d level=%d path=%s", 75ed1777deSTejun Heo __entry->root, __entry->id, __entry->level, __get_str(path)) 76ed1777deSTejun Heo ); 77ed1777deSTejun Heo 78ed1777deSTejun Heo DEFINE_EVENT(cgroup, cgroup_mkdir, 79ed1777deSTejun Heo 80e4f8d81cSSteven Rostedt (VMware) TP_PROTO(struct cgroup *cgrp, const char *path), 81ed1777deSTejun Heo 82e4f8d81cSSteven Rostedt (VMware) TP_ARGS(cgrp, path) 83ed1777deSTejun Heo ); 84ed1777deSTejun Heo 85ed1777deSTejun Heo DEFINE_EVENT(cgroup, cgroup_rmdir, 86ed1777deSTejun Heo 87e4f8d81cSSteven Rostedt (VMware) TP_PROTO(struct cgroup *cgrp, const char *path), 88ed1777deSTejun Heo 89e4f8d81cSSteven Rostedt (VMware) TP_ARGS(cgrp, path) 90ed1777deSTejun Heo ); 91ed1777deSTejun Heo 92ed1777deSTejun Heo DEFINE_EVENT(cgroup, cgroup_release, 93ed1777deSTejun Heo 94e4f8d81cSSteven Rostedt (VMware) TP_PROTO(struct cgroup *cgrp, const char *path), 95ed1777deSTejun Heo 96e4f8d81cSSteven Rostedt (VMware) TP_ARGS(cgrp, path) 97ed1777deSTejun Heo ); 98ed1777deSTejun Heo 99ed1777deSTejun Heo DEFINE_EVENT(cgroup, cgroup_rename, 100ed1777deSTejun Heo 101e4f8d81cSSteven Rostedt (VMware) TP_PROTO(struct cgroup *cgrp, const char *path), 102ed1777deSTejun Heo 103e4f8d81cSSteven Rostedt (VMware) TP_ARGS(cgrp, path) 104ed1777deSTejun Heo ); 105ed1777deSTejun Heo 106*4c476d8cSRoman Gushchin DEFINE_EVENT(cgroup, cgroup_freeze, 107*4c476d8cSRoman Gushchin 108*4c476d8cSRoman Gushchin TP_PROTO(struct cgroup *cgrp, const char *path), 109*4c476d8cSRoman Gushchin 110*4c476d8cSRoman Gushchin TP_ARGS(cgrp, path) 111*4c476d8cSRoman Gushchin ); 112*4c476d8cSRoman Gushchin 113*4c476d8cSRoman Gushchin DEFINE_EVENT(cgroup, cgroup_unfreeze, 114*4c476d8cSRoman Gushchin 115*4c476d8cSRoman Gushchin TP_PROTO(struct cgroup *cgrp, const char *path), 116*4c476d8cSRoman Gushchin 117*4c476d8cSRoman Gushchin TP_ARGS(cgrp, path) 118*4c476d8cSRoman Gushchin ); 119*4c476d8cSRoman Gushchin 120ed1777deSTejun Heo DECLARE_EVENT_CLASS(cgroup_migrate, 121ed1777deSTejun Heo 122e4f8d81cSSteven Rostedt (VMware) TP_PROTO(struct cgroup *dst_cgrp, const char *path, 123e4f8d81cSSteven Rostedt (VMware) struct task_struct *task, bool threadgroup), 124ed1777deSTejun Heo 125e4f8d81cSSteven Rostedt (VMware) TP_ARGS(dst_cgrp, path, task, threadgroup), 126ed1777deSTejun Heo 127ed1777deSTejun Heo TP_STRUCT__entry( 128ed1777deSTejun Heo __field( int, dst_root ) 129ed1777deSTejun Heo __field( int, dst_id ) 130ed1777deSTejun Heo __field( int, dst_level ) 131ed1777deSTejun Heo __field( int, pid ) 132e4f8d81cSSteven Rostedt (VMware) __string( dst_path, path ) 133ed1777deSTejun Heo __string( comm, task->comm ) 134ed1777deSTejun Heo ), 135ed1777deSTejun Heo 136ed1777deSTejun Heo TP_fast_assign( 137ed1777deSTejun Heo __entry->dst_root = dst_cgrp->root->hierarchy_id; 138ed1777deSTejun Heo __entry->dst_id = dst_cgrp->id; 139ed1777deSTejun Heo __entry->dst_level = dst_cgrp->level; 140e4f8d81cSSteven Rostedt (VMware) __assign_str(dst_path, path); 141ed1777deSTejun Heo __entry->pid = task->pid; 142ed1777deSTejun Heo __assign_str(comm, task->comm); 143ed1777deSTejun Heo ), 144ed1777deSTejun Heo 145ed1777deSTejun Heo TP_printk("dst_root=%d dst_id=%d dst_level=%d dst_path=%s pid=%d comm=%s", 146ed1777deSTejun Heo __entry->dst_root, __entry->dst_id, __entry->dst_level, 147ed1777deSTejun Heo __get_str(dst_path), __entry->pid, __get_str(comm)) 148ed1777deSTejun Heo ); 149ed1777deSTejun Heo 150ed1777deSTejun Heo DEFINE_EVENT(cgroup_migrate, cgroup_attach_task, 151ed1777deSTejun Heo 152e4f8d81cSSteven Rostedt (VMware) TP_PROTO(struct cgroup *dst_cgrp, const char *path, 153e4f8d81cSSteven Rostedt (VMware) struct task_struct *task, bool threadgroup), 154ed1777deSTejun Heo 155e4f8d81cSSteven Rostedt (VMware) TP_ARGS(dst_cgrp, path, task, threadgroup) 156ed1777deSTejun Heo ); 157ed1777deSTejun Heo 158ed1777deSTejun Heo DEFINE_EVENT(cgroup_migrate, cgroup_transfer_tasks, 159ed1777deSTejun Heo 160e4f8d81cSSteven Rostedt (VMware) TP_PROTO(struct cgroup *dst_cgrp, const char *path, 161e4f8d81cSSteven Rostedt (VMware) struct task_struct *task, bool threadgroup), 162ed1777deSTejun Heo 163e4f8d81cSSteven Rostedt (VMware) TP_ARGS(dst_cgrp, path, task, threadgroup) 164ed1777deSTejun Heo ); 165ed1777deSTejun Heo 166*4c476d8cSRoman Gushchin DECLARE_EVENT_CLASS(cgroup_event, 167*4c476d8cSRoman Gushchin 168*4c476d8cSRoman Gushchin TP_PROTO(struct cgroup *cgrp, const char *path, int val), 169*4c476d8cSRoman Gushchin 170*4c476d8cSRoman Gushchin TP_ARGS(cgrp, path, val), 171*4c476d8cSRoman Gushchin 172*4c476d8cSRoman Gushchin TP_STRUCT__entry( 173*4c476d8cSRoman Gushchin __field( int, root ) 174*4c476d8cSRoman Gushchin __field( int, id ) 175*4c476d8cSRoman Gushchin __field( int, level ) 176*4c476d8cSRoman Gushchin __string( path, path ) 177*4c476d8cSRoman Gushchin __field( int, val ) 178*4c476d8cSRoman Gushchin ), 179*4c476d8cSRoman Gushchin 180*4c476d8cSRoman Gushchin TP_fast_assign( 181*4c476d8cSRoman Gushchin __entry->root = cgrp->root->hierarchy_id; 182*4c476d8cSRoman Gushchin __entry->id = cgrp->id; 183*4c476d8cSRoman Gushchin __entry->level = cgrp->level; 184*4c476d8cSRoman Gushchin __assign_str(path, path); 185*4c476d8cSRoman Gushchin __entry->val = val; 186*4c476d8cSRoman Gushchin ), 187*4c476d8cSRoman Gushchin 188*4c476d8cSRoman Gushchin TP_printk("root=%d id=%d level=%d path=%s val=%d", 189*4c476d8cSRoman Gushchin __entry->root, __entry->id, __entry->level, __get_str(path), 190*4c476d8cSRoman Gushchin __entry->val) 191*4c476d8cSRoman Gushchin ); 192*4c476d8cSRoman Gushchin 193*4c476d8cSRoman Gushchin DEFINE_EVENT(cgroup_event, cgroup_notify_populated, 194*4c476d8cSRoman Gushchin 195*4c476d8cSRoman Gushchin TP_PROTO(struct cgroup *cgrp, const char *path, int val), 196*4c476d8cSRoman Gushchin 197*4c476d8cSRoman Gushchin TP_ARGS(cgrp, path, val) 198*4c476d8cSRoman Gushchin ); 199*4c476d8cSRoman Gushchin 200*4c476d8cSRoman Gushchin DEFINE_EVENT(cgroup_event, cgroup_notify_frozen, 201*4c476d8cSRoman Gushchin 202*4c476d8cSRoman Gushchin TP_PROTO(struct cgroup *cgrp, const char *path, int val), 203*4c476d8cSRoman Gushchin 204*4c476d8cSRoman Gushchin TP_ARGS(cgrp, path, val) 205*4c476d8cSRoman Gushchin ); 206*4c476d8cSRoman Gushchin 207ed1777deSTejun Heo #endif /* _TRACE_CGROUP_H */ 208ed1777deSTejun Heo 209ed1777deSTejun Heo /* This part must be outside protection */ 210ed1777deSTejun Heo #include <trace/define_trace.h> 211