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, level ) 63*e14da771SWilliam Kucharski __field( u64, id ) 64e4f8d81cSSteven Rostedt (VMware) __string( path, path ) 65ed1777deSTejun Heo ), 66ed1777deSTejun Heo 67ed1777deSTejun Heo TP_fast_assign( 68ed1777deSTejun Heo __entry->root = cgrp->root->hierarchy_id; 6974321038STejun Heo __entry->id = cgroup_id(cgrp); 70ed1777deSTejun Heo __entry->level = cgrp->level; 71e4f8d81cSSteven Rostedt (VMware) __assign_str(path, path); 72ed1777deSTejun Heo ), 73ed1777deSTejun Heo 74*e14da771SWilliam Kucharski TP_printk("root=%d id=%llu 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 1064c476d8cSRoman Gushchin DEFINE_EVENT(cgroup, cgroup_freeze, 1074c476d8cSRoman Gushchin 1084c476d8cSRoman Gushchin TP_PROTO(struct cgroup *cgrp, const char *path), 1094c476d8cSRoman Gushchin 1104c476d8cSRoman Gushchin TP_ARGS(cgrp, path) 1114c476d8cSRoman Gushchin ); 1124c476d8cSRoman Gushchin 1134c476d8cSRoman Gushchin DEFINE_EVENT(cgroup, cgroup_unfreeze, 1144c476d8cSRoman Gushchin 1154c476d8cSRoman Gushchin TP_PROTO(struct cgroup *cgrp, const char *path), 1164c476d8cSRoman Gushchin 1174c476d8cSRoman Gushchin TP_ARGS(cgrp, path) 1184c476d8cSRoman Gushchin ); 1194c476d8cSRoman 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_level ) 130*e14da771SWilliam Kucharski __field( u64, dst_id ) 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; 13874321038STejun Heo __entry->dst_id = cgroup_id(dst_cgrp); 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 145*e14da771SWilliam Kucharski TP_printk("dst_root=%d dst_id=%llu 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 1664c476d8cSRoman Gushchin DECLARE_EVENT_CLASS(cgroup_event, 1674c476d8cSRoman Gushchin 1684c476d8cSRoman Gushchin TP_PROTO(struct cgroup *cgrp, const char *path, int val), 1694c476d8cSRoman Gushchin 1704c476d8cSRoman Gushchin TP_ARGS(cgrp, path, val), 1714c476d8cSRoman Gushchin 1724c476d8cSRoman Gushchin TP_STRUCT__entry( 1734c476d8cSRoman Gushchin __field( int, root ) 1744c476d8cSRoman Gushchin __field( int, level ) 175*e14da771SWilliam Kucharski __field( u64, id ) 1764c476d8cSRoman Gushchin __string( path, path ) 1774c476d8cSRoman Gushchin __field( int, val ) 1784c476d8cSRoman Gushchin ), 1794c476d8cSRoman Gushchin 1804c476d8cSRoman Gushchin TP_fast_assign( 1814c476d8cSRoman Gushchin __entry->root = cgrp->root->hierarchy_id; 18274321038STejun Heo __entry->id = cgroup_id(cgrp); 1834c476d8cSRoman Gushchin __entry->level = cgrp->level; 1844c476d8cSRoman Gushchin __assign_str(path, path); 1854c476d8cSRoman Gushchin __entry->val = val; 1864c476d8cSRoman Gushchin ), 1874c476d8cSRoman Gushchin 188*e14da771SWilliam Kucharski TP_printk("root=%d id=%llu level=%d path=%s val=%d", 1894c476d8cSRoman Gushchin __entry->root, __entry->id, __entry->level, __get_str(path), 1904c476d8cSRoman Gushchin __entry->val) 1914c476d8cSRoman Gushchin ); 1924c476d8cSRoman Gushchin 1934c476d8cSRoman Gushchin DEFINE_EVENT(cgroup_event, cgroup_notify_populated, 1944c476d8cSRoman Gushchin 1954c476d8cSRoman Gushchin TP_PROTO(struct cgroup *cgrp, const char *path, int val), 1964c476d8cSRoman Gushchin 1974c476d8cSRoman Gushchin TP_ARGS(cgrp, path, val) 1984c476d8cSRoman Gushchin ); 1994c476d8cSRoman Gushchin 2004c476d8cSRoman Gushchin DEFINE_EVENT(cgroup_event, cgroup_notify_frozen, 2014c476d8cSRoman Gushchin 2024c476d8cSRoman Gushchin TP_PROTO(struct cgroup *cgrp, const char *path, int val), 2034c476d8cSRoman Gushchin 2044c476d8cSRoman Gushchin TP_ARGS(cgrp, path, val) 2054c476d8cSRoman Gushchin ); 2064c476d8cSRoman 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