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 10 DECLARE_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 32 DEFINE_EVENT(cgroup_root, cgroup_setup_root, 33 34 TP_PROTO(struct cgroup_root *root), 35 36 TP_ARGS(root) 37 ); 38 39 DEFINE_EVENT(cgroup_root, cgroup_destroy_root, 40 41 TP_PROTO(struct cgroup_root *root), 42 43 TP_ARGS(root) 44 ); 45 46 DEFINE_EVENT(cgroup_root, cgroup_remount, 47 48 TP_PROTO(struct cgroup_root *root), 49 50 TP_ARGS(root) 51 ); 52 53 DECLARE_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 cgroup_path(cgrp, NULL, 0) + 1) 65 ), 66 67 TP_fast_assign( 68 __entry->root = cgrp->root->hierarchy_id; 69 __entry->id = cgrp->id; 70 __entry->level = cgrp->level; 71 cgroup_path(cgrp, __get_dynamic_array(path), 72 __get_dynamic_array_len(path)); 73 ), 74 75 TP_printk("root=%d id=%d level=%d path=%s", 76 __entry->root, __entry->id, __entry->level, __get_str(path)) 77 ); 78 79 DEFINE_EVENT(cgroup, cgroup_mkdir, 80 81 TP_PROTO(struct cgroup *cgroup), 82 83 TP_ARGS(cgroup) 84 ); 85 86 DEFINE_EVENT(cgroup, cgroup_rmdir, 87 88 TP_PROTO(struct cgroup *cgroup), 89 90 TP_ARGS(cgroup) 91 ); 92 93 DEFINE_EVENT(cgroup, cgroup_release, 94 95 TP_PROTO(struct cgroup *cgroup), 96 97 TP_ARGS(cgroup) 98 ); 99 100 DEFINE_EVENT(cgroup, cgroup_rename, 101 102 TP_PROTO(struct cgroup *cgroup), 103 104 TP_ARGS(cgroup) 105 ); 106 107 DECLARE_EVENT_CLASS(cgroup_migrate, 108 109 TP_PROTO(struct cgroup *dst_cgrp, struct task_struct *task, bool threadgroup), 110 111 TP_ARGS(dst_cgrp, task, threadgroup), 112 113 TP_STRUCT__entry( 114 __field( int, dst_root ) 115 __field( int, dst_id ) 116 __field( int, dst_level ) 117 __dynamic_array(char, dst_path, 118 cgroup_path(dst_cgrp, NULL, 0) + 1) 119 __field( int, pid ) 120 __string( comm, task->comm ) 121 ), 122 123 TP_fast_assign( 124 __entry->dst_root = dst_cgrp->root->hierarchy_id; 125 __entry->dst_id = dst_cgrp->id; 126 __entry->dst_level = dst_cgrp->level; 127 cgroup_path(dst_cgrp, __get_dynamic_array(dst_path), 128 __get_dynamic_array_len(dst_path)); 129 __entry->pid = task->pid; 130 __assign_str(comm, task->comm); 131 ), 132 133 TP_printk("dst_root=%d dst_id=%d dst_level=%d dst_path=%s pid=%d comm=%s", 134 __entry->dst_root, __entry->dst_id, __entry->dst_level, 135 __get_str(dst_path), __entry->pid, __get_str(comm)) 136 ); 137 138 DEFINE_EVENT(cgroup_migrate, cgroup_attach_task, 139 140 TP_PROTO(struct cgroup *dst_cgrp, struct task_struct *task, bool threadgroup), 141 142 TP_ARGS(dst_cgrp, task, threadgroup) 143 ); 144 145 DEFINE_EVENT(cgroup_migrate, cgroup_transfer_tasks, 146 147 TP_PROTO(struct cgroup *dst_cgrp, struct task_struct *task, bool threadgroup), 148 149 TP_ARGS(dst_cgrp, task, threadgroup) 150 ); 151 152 #endif /* _TRACE_CGROUP_H */ 153 154 /* This part must be outside protection */ 155 #include <trace/define_trace.h> 156