--- kernel/trace/latency_hist.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) Index: linux-4.4.39-rt50/kernel/trace/latency_hist.c =================================================================== @ linux-4.4.39-rt50/kernel/trace/latency_hist.c:129 @ static notrace void probe_wakeup_latency struct task_struct *p); static notrace void probe_wakeup_latency_hist_stop(void *v, bool preempt, struct task_struct *prev, struct task_struct *next); +#ifdef CONFIG_SMP static notrace void probe_sched_migrate_task(void *, struct task_struct *task, int cpu); +#endif static struct enable_data wakeup_latency_enabled_data = { .latency_type = WAKEUP_LATENCY, .enabled = 0, @ linux-4.4.39-rt50/kernel/trace/latency_hist.c:697 @ do_enable(struct file *file, const char probe_wakeup_latency_hist_start, NULL); return ret; } +#ifdef CONFIG_SMP ret = register_trace_sched_migrate_task( probe_sched_migrate_task, NULL); if (ret) { @ linux-4.4.39-rt50/kernel/trace/latency_hist.c:710 @ do_enable(struct file *file, const char probe_wakeup_latency_hist_stop, NULL); return ret; } +#endif break; #endif #ifdef CONFIG_MISSED_TIMER_OFFSETS_HIST @ linux-4.4.39-rt50/kernel/trace/latency_hist.c:793 @ do_enable(struct file *file, const char probe_wakeup_latency_hist_start, NULL); unregister_trace_sched_switch( probe_wakeup_latency_hist_stop, NULL); +#ifdef CONFIG_SMP unregister_trace_sched_migrate_task( probe_sched_migrate_task, NULL); +#endif for_each_online_cpu(cpu) { per_cpu(wakeup_task, cpu) = NULL; @ linux-4.4.39-rt50/kernel/trace/latency_hist.c:984 @ static DEFINE_RAW_SPINLOCK(wakeup_lock); #ifdef CONFIG_SWITCHTIME_HIST static DEFINE_RAW_SPINLOCK(switchtime_lock); #endif +#ifdef CONFIG_SMP static notrace void probe_sched_migrate_task(void *v, struct task_struct *task, int cpu) { @ linux-4.4.39-rt50/kernel/trace/latency_hist.c:1022 @ static notrace void probe_sched_migrate_ #endif } } +#endif /* CONFIG_SMP */ static notrace void probe_wakeup_latency_hist_start(void *v, struct task_struct *p) @ linux-4.4.39-rt50/kernel/trace/latency_hist.c:1151 @ out: raw_spin_lock_irqsave(&switchtime_lock, flags); - cpu_switchtime_task = per_cpu(switchtime_task, cpu) = - next; + cpu_switchtime_task = per_cpu(switchtime_task, cpu); + if (cpu_switchtime_task != NULL) + put_task_struct(cpu_switchtime_task); + cpu_switchtime_task = next; + per_cpu(switchtime_task, cpu) = cpu_switchtime_task; get_task_struct(cpu_switchtime_task); raw_spin_unlock_irqrestore(&switchtime_lock, flags);