Re: [PATCH v4 1/4] ftrace: Implement fs notification for tracing_max_latency

From: Peter Zijlstra
Date: Wed May 22 2019 - 10:34:43 EST


On Tue, May 21, 2019 at 12:01:42PM -0400, Steven Rostedt wrote:
>
> [ Added Peter and Rafael ]

Thanks Steve,

> On Fri, 17 May 2019 22:34:27 +0200
> Viktor Rosendahl <viktor.rosendahl@xxxxxxxxx> wrote:

> > diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
> > index c8c7c7efb487..a1a1befea1c1 100644
> > --- a/include/trace/events/sched.h
> > +++ b/include/trace/events/sched.h
> > @@ -183,6 +183,46 @@ TRACE_EVENT(sched_switch,
> > __entry->next_comm, __entry->next_pid, __entry->next_prio)
> > );
> >
> > +/*
> > + * Tracepoint for entering __schedule():
> > + */
> > +TRACE_EVENT(sched_schedule_enter,
> > +
> > + TP_PROTO(int cpu),
> > +
> > + TP_ARGS(cpu),
> > +
> > + TP_STRUCT__entry(
> > + __field(int, cpu)
> > + ),
> > +
> > + TP_fast_assign(
> > + __entry->cpu = cpu;
> > + ),
> > +
> > + TP_printk("cpu=%d", __entry->cpu)
> > +);
> > +
> > +/*
> > + * Tracepoint for exiting __schedule():
> > + */
> > +TRACE_EVENT(sched_schedule_exit,
> > +
> > + TP_PROTO(int cpu),
> > +
> > + TP_ARGS(cpu),
> > +
> > + TP_STRUCT__entry(
> > + __field(int, cpu)
> > + ),
> > +
> > + TP_fast_assign(
> > + __entry->cpu = cpu;
> > + ),
> > +
> > + TP_printk("cpu=%d", __entry->cpu)
> > +);
> > +
> > /*
> > * Tracepoint for a task being migrated:
> > */
> > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> > index 102dfcf0a29a..c9d86fcc48f5 100644
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -3374,6 +3374,7 @@ static void __sched notrace __schedule(bool preempt)
> > int cpu;
> >
> > cpu = smp_processor_id();
> > + trace_sched_schedule_enter(cpu);
> > rq = cpu_rq(cpu);
> > prev = rq->curr;
> >
> > @@ -3448,6 +3449,7 @@ static void __sched notrace __schedule(bool preempt)
> > }
> >
> > balance_callback(rq);
> > + trace_sched_schedule_exit(cpu);
> > }
> >
> > void __noreturn do_task_dead(void)
> > diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
> > index f5516bae0c1b..e328e045c6e8 100644
> > --- a/kernel/sched/idle.c
> > +++ b/kernel/sched/idle.c
> > @@ -224,6 +224,7 @@ static void cpuidle_idle_call(void)
> > static void do_idle(void)
> > {
> > int cpu = smp_processor_id();
> > + trace_do_idle_enter(cpu);
> > /*
> > * If the arch has a polling bit, we maintain an invariant:
> > *
> > @@ -287,6 +288,7 @@ static void do_idle(void)
> >
> > if (unlikely(klp_patch_pending(current)))
> > klp_update_patch_state(current);
> > + trace_do_idle_exit(cpu);
> > }
> >
> > bool cpu_in_idle(unsigned long pc)

NAK!