All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mel Gorman <mgorman@techsingularity.net>
To: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	Mike Galbraith <mgalbraith@suse.de>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] sched: Make schedstats a runtime tunable that is disabled by default v2
Date: Thu, 28 Jan 2016 10:59:25 +0000	[thread overview]
Message-ID: <20160128105925.GM3162@techsingularity.net> (raw)
In-Reply-To: <20160128103208.GB2571@codeblueprint.co.uk>

On Thu, Jan 28, 2016 at 10:32:08AM +0000, Matt Fleming wrote:
> On Wed, 27 Jan, at 03:29:26PM, Mel Gorman wrote:
> > +#ifdef CONFIG_SCHEDSTATS
> > +void set_schedstats(bool enabled)
> > +{
> > +	if (enabled)
> > +		static_branch_enable(&sched_schedstats);
> > +	else
> > +		static_branch_disable(&sched_schedstats);
> > +}
> 
> This function should probably be 'static'; it has no users outside of
> this file.
> 

Yes.

> > @@ -313,17 +317,19 @@ do {									\
> >  #define P(n) SEQ_printf(m, "  .%-30s: %d\n", #n, rq->n);
> >  #define P64(n) SEQ_printf(m, "  .%-30s: %Ld\n", #n, rq->n);
> >  
> > -	P(yld_count);
> > +	if (schedstat_enabled()) {
> > +		P(yld_count);
> >  
> > -	P(sched_count);
> > -	P(sched_goidle);
> > +		P(sched_count);
> > +		P(sched_goidle);
> >  #ifdef CONFIG_SMP
> > -	P64(avg_idle);
> > -	P64(max_idle_balance_cost);
> > +		P64(avg_idle);
> > +		P64(max_idle_balance_cost);
> 
> These two fields are still updated without any kind of
> schedstat_enabled() guard. We probably shouldn't refuse to print them
> if we're maintaining these counters, right?
> 

Right.

> >  #undef P
> >  #undef P64
> > @@ -569,38 +575,38 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
> >  	nr_switches = p->nvcsw + p->nivcsw;
> >  
> >  #ifdef CONFIG_SCHEDSTATS
> > -	PN(se.statistics.sum_sleep_runtime);
> > -	PN(se.statistics.wait_start);
> > -	PN(se.statistics.sleep_start);
> > -	PN(se.statistics.block_start);
> > -	PN(se.statistics.sleep_max);
> > -	PN(se.statistics.block_max);
> > -	PN(se.statistics.exec_max);
> > -	PN(se.statistics.slice_max);
> > -	PN(se.statistics.wait_max);
> > -	PN(se.statistics.wait_sum);
> > -	P(se.statistics.wait_count);
> > -	PN(se.statistics.iowait_sum);
> > -	P(se.statistics.iowait_count);
> > -	P(se.nr_migrations);
> > -	P(se.statistics.nr_migrations_cold);
> > -	P(se.statistics.nr_failed_migrations_affine);
> > -	P(se.statistics.nr_failed_migrations_running);
> > -	P(se.statistics.nr_failed_migrations_hot);
> > -	P(se.statistics.nr_forced_migrations);
> > -	P(se.statistics.nr_wakeups);
> > -	P(se.statistics.nr_wakeups_sync);
> > -	P(se.statistics.nr_wakeups_migrate);
> > -	P(se.statistics.nr_wakeups_local);
> > -	P(se.statistics.nr_wakeups_remote);
> > -	P(se.statistics.nr_wakeups_affine);
> > -	P(se.statistics.nr_wakeups_affine_attempts);
> > -	P(se.statistics.nr_wakeups_passive);
> > -	P(se.statistics.nr_wakeups_idle);
> > -
> > -	{
> > +	if (schedstat_enabled()) {
> >  		u64 avg_atom, avg_per_cpu;
> >  
> > +		PN(se.statistics.sum_sleep_runtime);
> > +		PN(se.statistics.wait_start);
> > +		PN(se.statistics.sleep_start);
> > +		PN(se.statistics.block_start);
> > +		PN(se.statistics.sleep_max);
> > +		PN(se.statistics.block_max);
> > +		PN(se.statistics.exec_max);
> > +		PN(se.statistics.slice_max);
> > +		PN(se.statistics.wait_max);
> > +		PN(se.statistics.wait_sum);
> > +		P(se.statistics.wait_count);
> > +		PN(se.statistics.iowait_sum);
> > +		P(se.statistics.iowait_count);
> > +		P(se.nr_migrations);
> 
> Ditto for se.nr_migrations. It has no schedstat_enabled() wrapper.
> 

Yes.

> > @@ -801,8 +793,8 @@ static void update_stats_enqueue(struct cfs_rq *cfs_rq, struct sched_entity *se)
> >  		update_stats_wait_start(cfs_rq, se);
> >  }
> >  
> > -static inline void
> > -update_stats_dequeue(struct cfs_rq *cfs_rq, struct sched_entity *se)
> > +static void
> > +update_stats_dequeue(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
> >  {
> >  	/*
> >  	 * Mark the end of the wait period if dequeueing a
> 
> You dropped the 'inline' from this function. Since there is only one
> caller, I'm guessing that was unintentional?

It wasn't really. The patch increased the function size by enough that
I uninlined it and let the compiler make the decision. In this case,
it should automatically inline but I can leave the inline in.

-- 
Mel Gorman
SUSE Labs

  reply	other threads:[~2016-01-28 10:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-27 15:29 [PATCH] sched: Make schedstats a runtime tunable that is disabled by default v2 Mel Gorman
2016-01-27 15:58 ` Mike Galbraith
2016-01-28 10:32 ` Matt Fleming
2016-01-28 10:59   ` Mel Gorman [this message]
2016-01-28 11:34     ` Matt Fleming

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=20160128105925.GM3162@techsingularity.net \
    --to=mgorman@techsingularity.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@codeblueprint.co.uk \
    --cc=mgalbraith@suse.de \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    /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.