#include <linux/module.h>
#include <linux/kallsyms.h>
#include <linux/uaccess.h>
#include <linux/ftrace.h>
#include <trace/events/sched.h>
static int sched_cmdline_ref;
static int sched_tgid_ref;
static DEFINE_MUTEX(sched_register_mutex);
probe_sched_switch(void *ignore, bool preempt,
struct task_struct *prev, struct task_struct *next)
flags = (RECORD_TGID * !!sched_tgid_ref) +
(RECORD_CMDLINE * !!sched_cmdline_ref);
tracing_record_taskinfo_sched_switch(prev, next, flags);
probe_sched_wakeup(void *ignore, struct task_struct *wakee)
flags = (RECORD_TGID * !!sched_tgid_ref) +
(RECORD_CMDLINE * !!sched_cmdline_ref);
tracing_record_taskinfo(current, flags);
static int tracing_sched_register(void)
ret = register_trace_sched_wakeup(probe_sched_wakeup, NULL);
pr_info("wakeup trace: Couldn't activate tracepoint"
" probe to kernel_sched_wakeup\n");
ret = register_trace_sched_wakeup_new(probe_sched_wakeup, NULL);
pr_info("wakeup trace: Couldn't activate tracepoint"