public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Li Zhong <zhong@linux.vnet.ibm.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <bp@alien8.de>, Alex Shi <alex.shi@intel.com>,
	Paul Turner <pjt@google.com>, Mike Galbraith <efault@gmx.de>,
	Vincent Guittot <vincent.guittot@linaro.org>
Subject: Re: [RFC PATCH 2/4] sched: Consolidate nohz cpu load prelude code
Date: Thu, 20 Jun 2013 14:01:07 -0700	[thread overview]
Message-ID: <20130620210107.GM4082@linux.vnet.ibm.com> (raw)
In-Reply-To: <1371761141-25386-3-git-send-email-fweisbec@gmail.com>

On Thu, Jun 20, 2013 at 10:45:39PM +0200, Frederic Weisbecker wrote:
> Gather the common code that computes the pending idle cpu load
> to decay.
> 
> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Li Zhong <zhong@linux.vnet.ibm.com>
> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Alex Shi <alex.shi@intel.com>
> Cc: Paul Turner <pjt@google.com>
> Cc: Mike Galbraith <efault@gmx.de>
> Cc: Vincent Guittot <vincent.guittot@linaro.org>
> ---
>  kernel/sched/proc.c |   40 ++++++++++++++--------------------------
>  1 files changed, 14 insertions(+), 26 deletions(-)
> 
> diff --git a/kernel/sched/proc.c b/kernel/sched/proc.c
> index bb3a6a0..030528a 100644
> --- a/kernel/sched/proc.c
> +++ b/kernel/sched/proc.c
> @@ -470,11 +470,14 @@ decay_load_missed(unsigned long load, unsigned long missed_updates, int idx)
>   * scheduler tick (TICK_NSEC). With tickless idle this will not be called
>   * every tick. We fix it up based on jiffies.
>   */
> -static void __update_cpu_load(struct rq *this_rq, unsigned long this_load,
> -			      unsigned long pending_updates)
> +static void __update_cpu_load(struct rq *this_rq, unsigned long this_load)
>  {
> +	unsigned long curr_jiffies = ACCESS_ONCE(jiffies);

Isn't jiffies declared volatile?  (Looks that way to me.)  If so, there
is no need for ACCESS_ONCE().

> +	unsigned long pending_updates;
>  	int i, scale;
> 
> +	pending_updates = curr_jiffies - this_rq->last_load_update_tick;
> +	this_rq->last_load_update_tick = curr_jiffies;
>  	this_rq->nr_load_updates++;
> 
>  	/* Update our load: */
> @@ -521,20 +524,15 @@ static void __update_cpu_load(struct rq *this_rq, unsigned long this_load,
>   */
>  void update_idle_cpu_load(struct rq *this_rq)
>  {
> -	unsigned long curr_jiffies = ACCESS_ONCE(jiffies);
>  	unsigned long load = this_rq->load.weight;
> -	unsigned long pending_updates;
> 
>  	/*
>  	 * bail if there's load or we're actually up-to-date.
>  	 */
> -	if (load || curr_jiffies == this_rq->last_load_update_tick)
> +	if (load || jiffies == this_rq->last_load_update_tick)
>  		return;
> 
> -	pending_updates = curr_jiffies - this_rq->last_load_update_tick;
> -	this_rq->last_load_update_tick = curr_jiffies;
> -
> -	__update_cpu_load(this_rq, load, pending_updates);
> +	__update_cpu_load(this_rq, load);
>  }
> 
>  /*
> @@ -543,22 +541,16 @@ void update_idle_cpu_load(struct rq *this_rq)
>  void update_cpu_load_nohz(void)
>  {
>  	struct rq *this_rq = this_rq();
> -	unsigned long curr_jiffies = ACCESS_ONCE(jiffies);
> -	unsigned long pending_updates;
> 
> -	if (curr_jiffies == this_rq->last_load_update_tick)
> +	if (jiffies == this_rq->last_load_update_tick)
>  		return;
> 
>  	raw_spin_lock(&this_rq->lock);
> -	pending_updates = curr_jiffies - this_rq->last_load_update_tick;
> -	if (pending_updates) {
> -		this_rq->last_load_update_tick = curr_jiffies;
> -		/*
> -		 * We were idle, this means load 0, the current load might be
> -		 * !0 due to remote wakeups and the sort.
> -		 */
> -		__update_cpu_load(this_rq, 0, pending_updates);
> -	}
> +	/*
> +	 * We were idle, this means load 0, the current load might be
> +	 * !0 due to remote wakeups and the sort.
> +	 */
> +	__update_cpu_load(this_rq, 0);
>  	raw_spin_unlock(&this_rq->lock);
>  }
>  #endif /* CONFIG_NO_HZ */
> @@ -568,11 +560,7 @@ void update_cpu_load_nohz(void)
>   */
>  void update_cpu_load_active(struct rq *this_rq)
>  {
> -	/*
> -	 * See the mess around update_idle_cpu_load() / update_cpu_load_nohz().
> -	 */
> -	this_rq->last_load_update_tick = jiffies;
> -	__update_cpu_load(this_rq, this_rq->load.weight, 1);
> +	__update_cpu_load(this_rq, this_rq->load.weight);
> 
>  	calc_load_account_active(this_rq);
>  }
> -- 
> 1.7.5.4
> 


  reply	other threads:[~2013-06-20 21:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-20 20:45 [RFC PATCH 0/4] sched: Disabled LB_BIAS with full dynticks Frederic Weisbecker
2013-06-20 20:45 ` [RFC PATCH 1/4] sched: Disable lb_bias feature for " Frederic Weisbecker
2013-06-20 21:01   ` Paul E. McKenney
2013-06-20 20:45 ` [RFC PATCH 2/4] sched: Consolidate nohz cpu load prelude code Frederic Weisbecker
2013-06-20 21:01   ` Paul E. McKenney [this message]
2013-06-20 20:45 ` [RFC PATCH 3/4] sched: Conditionally build decaying cpu load stats Frederic Weisbecker
2013-06-20 20:45 ` [RFC PATCH 4/4] sched: Consolidate open coded preemptible() checks Frederic Weisbecker
2013-06-26 13:05   ` Peter Zijlstra
2013-07-01 11:20     ` Frederic Weisbecker
2013-07-01 11:55       ` Peter Zijlstra

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=20130620210107.GM4082@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=alex.shi@intel.com \
    --cc=bp@alien8.de \
    --cc=efault@gmx.de \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=vincent.guittot@linaro.org \
    --cc=zhong@linux.vnet.ibm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox