^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #undef TRACE_SYSTEM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define TRACE_SYSTEM task
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #if !defined(_TRACE_TASK_H) || defined(TRACE_HEADER_MULTI_READ)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #define _TRACE_TASK_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/tracepoint.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) TRACE_EVENT(task_newtask,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) TP_PROTO(struct task_struct *task, unsigned long clone_flags),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) TP_ARGS(task, clone_flags),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) __field( pid_t, pid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) __array( char, comm, TASK_COMM_LEN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) __field( unsigned long, clone_flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) __field( short, oom_score_adj)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) __entry->pid = task->pid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) memcpy(__entry->comm, task->comm, TASK_COMM_LEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) __entry->clone_flags = clone_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) __entry->oom_score_adj = task->signal->oom_score_adj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) TP_printk("pid=%d comm=%s clone_flags=%lx oom_score_adj=%hd",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) __entry->pid, __entry->comm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) __entry->clone_flags, __entry->oom_score_adj)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) TRACE_EVENT(task_rename,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) TP_PROTO(struct task_struct *task, const char *comm),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) TP_ARGS(task, comm),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) __field( pid_t, pid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) __array( char, oldcomm, TASK_COMM_LEN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) __array( char, newcomm, TASK_COMM_LEN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) __field( short, oom_score_adj)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) __entry->pid = task->pid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) memcpy(entry->oldcomm, task->comm, TASK_COMM_LEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) strlcpy(entry->newcomm, comm, TASK_COMM_LEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) __entry->oom_score_adj = task->signal->oom_score_adj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) TP_printk("pid=%d oldcomm=%s newcomm=%s oom_score_adj=%hd",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) __entry->pid, __entry->oldcomm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) __entry->newcomm, __entry->oom_score_adj)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) /* This part must be outside protection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #include <trace/define_trace.h>