All of lore.kernel.org
 help / color / mirror / Atom feed
From: Javi Merino <javi.merino@arm.com>
To: Jacob Pan <jacob.jun.pan@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	John Stultz <john.stultz@linaro.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Arjan van de Ven <arjan@linux.intel.com>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Len Brown <len.brown@intel.com>,
	Rafael Wysocki <rafael.j.wysocki@intel.com>,
	Eduardo Valentin <edubezval@gmail.com>,
	Paul Turner <pjt@google.com>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH 4/4] sched: add trace event for idle injection
Date: Thu, 19 Nov 2015 14:39:35 +0000	[thread overview]
Message-ID: <20151119143934.GB9512@e104805> (raw)
In-Reply-To: <1447444387-23525-5-git-send-email-jacob.jun.pan@linux.intel.com>

[ CCing Steve Rostedt for the tracing bits ]

On Fri, Nov 13, 2015 at 11:53:07AM -0800, Jacob Pan wrote:
> Trace events for idle injection can be used to determine
> timer activities for checking synchronization. In addition they
> also helps to determine when the runqueue is throttled.
> 
> Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
> ---
>  include/linux/sched.h        |  5 +++++
>  include/trace/events/sched.h | 25 +++++++++++++++++++++++++
>  kernel/sched/fair.c          |  3 +++
>  3 files changed, 33 insertions(+)
> 
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index ff551a3..99c79bf 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -3189,6 +3189,11 @@ extern int proc_sched_cfs_idle_inject_duration_handler(struct ctl_table *table,
>  						int write,
>  						void __user *buffer,
>  						size_t *length, loff_t *ppos);
> +enum cfs_idle_inject_action {
> +	CFS_IDLE_INJECT_TIMER,    /* timer sync point */
> +	CFS_IDLE_INJECT_FORCED,   /* idle forced in rq */
> +	CFS_IDLE_INJECT_YIELD_SOFTIRQ   /* yield to pending softirq */
> +};
>  #endif
>  
>  #endif
> diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
> index 539d6bc..52c11c1 100644
> --- a/include/trace/events/sched.h
> +++ b/include/trace/events/sched.h
> @@ -566,6 +566,31 @@ TRACE_EVENT(sched_wake_idle_without_ipi,
>  
>  	TP_printk("cpu=%d", __entry->cpu)
>  );
> +
> +#ifdef CONFIG_CFS_IDLE_INJECT
> +/*
> + * Tracepoint for idle injection
> + */
> +TRACE_EVENT(sched_cfs_idle_inject,
> +
> +	TP_PROTO(enum cfs_idle_inject_action action, int throttled),
> +
> +	TP_ARGS(action, throttled),
> +
> +	TP_STRUCT__entry(
> +		__field(enum cfs_idle_inject_action, action)
> +		__field(int, throttled)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->action = action;
> +		__entry->throttled = throttled;
> +	),
> +
> +	TP_printk("action:%d throttled:%d", __entry->action, __entry->throttled)
> +);
> +#endif
> +

One minor nit: can you use key=value (i.e. "throttled=%d") instead for
consistency with the rest of this file?

Other than that, I know that Peter suggested an enum for the action,
but wouldn't it be better to create an EVENT_CLASS and subclass the
three actions from it?  Something like:

DECLARE_EVENT_CLASS(sched_cfs_idle_inject_template,

	TP_PROTO(int throttled),

	TP_ARGS(throttled),

	TP_STRUCT__entry(
		__field(int, throttled)
	),

	TP_fast_assign(
		__entry->throttled = throttled;
	),

	TP_printk("throttled=%d", __entry->throttled)
);

DEFINE_EVENT(sched_cfs_idle_inject_template, sched_cfs_idle_inject_timer,
	     TP_PROTO(int throttled),
	     TP_ARGS(throttled));

DEFINE_EVENT(sched_cfs_idle_inject_template, sched_cfs_idle_inject_forced,
	     TP_PROTO(int throttled),
	     TP_ARGS(throttled));

DEFINE_EVENT(sched_cfs_idle_inject_template,
	     sched_cfs_idle_inject_yield_softirq,
	     TP_PROTO(int throttled),
	     TP_ARGS(throttled));

>  #endif /* _TRACE_SCHED_H */
>  
>  /* This part must be outside protection */
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index a0cd777..20027eb 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -5248,8 +5248,10 @@ idle:
>  	if (in_forced_idle(cfs_rq)) {
>  		if (unlikely(local_softirq_pending())) {
>  			__unthrottle_cfs_rq(cfs_rq);
> +			trace_sched_cfs_idle_inject(CFS_IDLE_INJECT_YIELD_SOFTIRQ, 1);

This becomes:

			trace_sched_cfs_idle_inject_yield_softirq(1);

>  			goto again;
>  		}
> +		trace_sched_cfs_idle_inject(CFS_IDLE_INJECT_FORCED, 1);

This becomes:
		trace_sched_cfs_idle_inject_forced(1);

>  		return NULL;
>  	}
>  	/*
> @@ -8432,6 +8434,7 @@ static enum hrtimer_restart idle_inject_timer_fn(struct hrtimer *hrtimer)
>  		throttle_rq(cpu);
>  	}
>  	raw_cpu_write(idle_injected, !status);
> +	trace_sched_cfs_idle_inject(CFS_IDLE_INJECT_TIMER, !status);

and this would be:

	trace_sched_cfs_idle_inject_timer(!status);

>  
>  	return HRTIMER_RESTART;
>  }

Cheers,
Javi

  parent reply	other threads:[~2015-11-19 14:39 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-13 19:53 [PATCH 0/4] CFS idle injection Jacob Pan
2015-11-13 19:53 ` [PATCH 1/4] ktime: add a roundup function Jacob Pan
2015-11-13 20:11   ` John Stultz
2015-11-13 22:33     ` Jacob Pan
2015-11-13 20:13   ` Thomas Gleixner
2015-11-13 22:36     ` Jacob Pan
2015-11-13 19:53 ` [PATCH 2/4] timer: relax tick stop in idle entry Jacob Pan
2015-11-13 20:22   ` Thomas Gleixner
2015-11-13 22:24     ` Jacob Pan
2015-11-16 15:06       ` Thomas Gleixner
2015-11-16 21:51         ` Jacob Pan
2015-11-16 22:01           ` Thomas Gleixner
2015-11-17  0:09             ` Jacob Pan
2015-11-19 17:43               ` Jacob Pan
2015-11-19 19:06               ` Peter Zijlstra
2015-11-19 19:21                 ` Jacob Pan
2015-11-19 19:59                   ` Peter Zijlstra
2015-11-19 23:41                     ` Jacob Pan
2015-11-16 22:31           ` Paul E. McKenney
2015-11-16 23:05             ` Jacob Pan
2015-11-16 23:15             ` Jacob Pan
2015-11-16 23:28               ` Paul E. McKenney
2015-11-16 23:32                 ` Arjan van de Ven
2015-11-16 23:40                   ` Jacob Pan
2015-11-17  0:00                     ` Paul E. McKenney
2015-11-16 22:32           ` Josh Triplett
2015-11-16 23:26             ` Paul E. McKenney
2015-11-17  1:41               ` Josh Triplett
2015-11-17  2:53                 ` Paul E. McKenney
2015-11-17  2:57                   ` Arjan van de Ven
2015-11-17  5:04                     ` Paul E. McKenney
2015-11-17 10:24                       ` Peter Zijlstra
2015-11-17 12:57                         ` Jacob Pan
2015-11-17 13:49                           ` Paul E. McKenney
2015-11-13 19:53 ` [PATCH 3/4] sched: introduce synchronized idle injection Jacob Pan
2015-11-13 20:23   ` kbuild test robot
2015-11-18  8:36   ` Ingo Molnar
2015-11-18 10:35     ` Peter Zijlstra
2015-11-18 12:27       ` Morten Rasmussen
2015-11-18 12:49         ` Peter Zijlstra
2015-11-18 14:04           ` Morten Rasmussen
2015-11-18 14:52             ` Jacob Pan
2015-11-18 15:09               ` Morten Rasmussen
2015-11-18 15:11                 ` Jacob Pan
2015-11-18 15:21                   ` Thomas Gleixner
2015-11-18 17:03                     ` Jacob Pan
2015-11-18 16:04                   ` Morten Rasmussen
2015-11-27  9:17       ` Ingo Molnar
2015-11-18 14:10     ` Jacob Pan
2015-11-27  9:17       ` Ingo Molnar
2015-12-02 17:28         ` Jacob Pan
2015-11-18 14:19     ` Arjan van de Ven
2015-11-18 15:44   ` Morten Rasmussen
2015-11-18 15:51     ` Arjan van de Ven
2015-11-19 17:24       ` Morten Rasmussen
2015-11-19 20:09         ` Peter Zijlstra
2015-11-20  9:45           ` Thomas Gleixner
2015-11-20 10:20             ` Peter Zijlstra
2015-11-20 10:58               ` Thomas Gleixner
2015-11-20 12:54                 ` Peter Zijlstra
2015-11-20 18:53                   ` Thomas Gleixner
2016-01-11 21:50                     ` Jacob Pan
2016-01-19 12:06                       ` Ingo Molnar
2016-01-19 18:00                         ` Jacob Pan
2015-11-24 11:38                 ` Jacob Pan
2015-11-23 17:59         ` Jacob Pan
2015-11-23 17:56   ` Javi Merino
2015-11-23 18:07     ` Peter Zijlstra
2015-11-24  9:12       ` Javi Merino
2015-11-24 10:09         ` Peter Zijlstra
2015-11-24 11:10           ` Jacob Pan
2015-11-24 12:00             ` Javi Merino
2015-11-24 18:22               ` Jacob Pan
2015-11-25  9:41                 ` Javi Merino
2015-11-13 19:53 ` [PATCH 4/4] sched: add trace event for " Jacob Pan
2015-11-13 20:10   ` kbuild test robot
2015-11-19 14:39   ` Javi Merino [this message]
2015-11-19 15:35     ` Jacob Pan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151119143934.GB9512@e104805 \
    --to=javi.merino@arm.com \
    --cc=arjan@linux.intel.com \
    --cc=edubezval@gmail.com \
    --cc=jacob.jun.pan@linux.intel.com \
    --cc=john.stultz@linaro.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rostedt@goodmis.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.