public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: "Alex,Shi" <alex.shi@intel.com>
Cc: Norbert Preining <preining@logic.at>,
	"Chen, Tim C" <tim.c.chen@intel.com>,
	"arjan@infradead.org" <arjan@infradead.org>,
	"efault@gmx.de" <efault@gmx.de>,
	"Li, Shaohua" <shaohua.li@intel.com>, tglx <tglx@linutronix.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Zhao, Yakui" <yakui.zhao@intel.com>
Subject: Re: high power consumption in recent kernels
Date: Thu, 30 Sep 2010 14:36:25 +0200	[thread overview]
Message-ID: <1285850185.2144.49.camel@laptop> (raw)
In-Reply-To: <1285835230.21962.1290.camel@debian>

On Thu, 2010-09-30 at 16:27 +0800, Alex,Shi wrote:
> Thanks Norbert! 
> Mike&Peter:
> would you like to add signed-off for the following patch?

I would really rather see the nohz decision move into the whole cpuidle
governor thing, which can make a much better cost vs benefit decision.

Thomas, Arjan?

> ---
>     sched: nohz_ratelimit function refresh
>     
>     The nohz_ratelimit() function that written by Mike Galbraith
>     can bring about more than 10% throughput for netperf TCP/UDP RR
>     when scheduling cross-cpu. It did this by reducing down to nohz
>     mode chance.
>     But the patch also reduce CPU chance to nohz mode after
>     interrupt processed, that cause Norbert's system have 4 watts power
>     increase(the system have about 100 int/sec and with a light load).
>     That is not acceptable for a laptop.
>     
>     So, I remove the nohz_ratelimit from irq_exit(). and then the
>     Norbert's system back to low power consumption.
>     
>     Tested-by: Norbert Preining <preining@logic.at>
>     Signed-off-by: Alex Shi <alex.shi@intel.com>
> 
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 1e2a6db..a4dbb37 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -274,8 +274,13 @@ extern cpumask_var_t nohz_cpu_mask;
>  #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ)
>  extern void select_nohz_load_balancer(int stop_tick);
>  extern int get_nohz_timer_target(void);
> +extern int nohz_ratelimit(int cpu);
>  #else
>  static inline void select_nohz_load_balancer(int stop_tick) { }
> +static inline int nohz_ratelimit(int cpu)
> +{
> +	return 0;
> +}
>  #endif
>  
>  /*
> diff --git a/kernel/sched.c b/kernel/sched.c
> index dc85ceb..132a21c 100644
> --- a/kernel/sched.c
> +++ b/kernel/sched.c
> @@ -1182,6 +1182,16 @@ static void resched_task(struct task_struct *p)
>  		smp_send_reschedule(cpu);
>  }
>  
> +int nohz_ratelimit(int cpu)
> +{
> +	struct rq *rq = cpu_rq(cpu);
> +	u64 diff = rq->clock - rq->nohz_stamp;
> +
> +	rq->nohz_stamp = rq->clock;
> +
> +	return diff < (NSEC_PER_SEC / HZ) >> 1;
> +}
> +
>  static void resched_cpu(int cpu)
>  {
>  	struct rq *rq = cpu_rq(cpu);
> diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
> index 3e216e0..19a7914 100644
> --- a/kernel/time/tick-sched.c
> +++ b/kernel/time/tick-sched.c
> @@ -325,7 +325,7 @@ void tick_nohz_stop_sched_tick(int inidle)
>  	} while (read_seqretry(&xtime_lock, seq));
>  
>  	if (rcu_needs_cpu(cpu) || printk_needs_cpu(cpu) ||
> -	    arch_needs_cpu(cpu)) {
> +		arch_needs_cpu(cpu) || (inidle && nohz_ratelimit(cpu))) {
>  		next_jiffies = last_jiffies + 1;
>  		delta_jiffies = 1;
>  	} else {
> 
> 



  reply	other threads:[~2010-09-30 12:36 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1283840425.26157.6486.camel@debian>
     [not found] ` <20100909093140.GC29648@gamma.logic.tuwien.ac.at>
     [not found]   ` <EA929A9653AAE14F841771FB1DE5A1366008738EC2@rrsmsx501.amr.corp.intel.com>
     [not found]     ` <20100909205115.GD11053@gamma.logic.tuwien.ac.at>
     [not found]       ` <1284107099.402.30.camel@laptop>
2010-09-10 14:48         ` high power consumption in recent kernels Shi, Alex
2010-09-10 14:54           ` Norbert Preining
2010-09-13  5:21             ` Alex,Shi
2010-09-17  2:09               ` Alex,Shi
2010-09-22 15:44               ` Norbert Preining
2010-09-28 10:40                 ` Alex,Shi
2010-09-29 14:39                   ` Norbert Preining
2010-09-29 15:48                     ` Chen, Tim C
2010-09-30  0:50                     ` Alex,Shi
2010-09-30  2:01                       ` Norbert Preining
2010-09-30  6:59                       ` Norbert Preining
2010-09-30  8:27                         ` Alex,Shi
2010-09-30 12:36                           ` Peter Zijlstra [this message]
2010-09-30 13:21                             ` Shi, Alex
2010-07-06 16:45 Norbert Preining
2010-07-08  9:06 ` Peter Zijlstra
2010-07-08 11:57   ` Arjan van de Ven
2010-07-08 11:58     ` Peter Zijlstra
2010-07-08 12:04       ` Norbert Preining
2010-07-08 12:22         ` Peter Zijlstra
2010-07-08 12:46           ` Norbert Preining
2010-07-08 13:23             ` Peter Zijlstra
2010-07-08 15:59               ` Peter Zijlstra
2010-07-08 19:06                 ` Peter Zijlstra
2010-07-08 19:40                 ` Mike Galbraith
2010-07-08 20:44                   ` Peter Zijlstra
2010-07-09  3:08                     ` Arjan van de Ven
2010-07-09  5:55                     ` Mike Galbraith
2010-07-08 19:37               ` Mike Galbraith
2010-07-08 15:11       ` Arjan van de Ven
2010-07-09 19:09   ` Pavel Machek

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=1285850185.2144.49.camel@laptop \
    --to=peterz@infradead.org \
    --cc=alex.shi@intel.com \
    --cc=arjan@infradead.org \
    --cc=efault@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=preining@logic.at \
    --cc=shaohua.li@intel.com \
    --cc=tglx@linutronix.de \
    --cc=tim.c.chen@intel.com \
    --cc=yakui.zhao@intel.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