mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lan Tianyu <tianyu.lan@intel.com>
To: rjw@rjwysocki.net, viresh.kumar@linaro.org
Cc: Lan Tianyu <tianyu.lan@intel.com>,
	cpufreq@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH V2 2/2] Cpufreq/gov: use tick_nohz_check() to check idle micro accouting support
Date: Fri, 15 Nov 2013 16:35:35 +0800	[thread overview]
Message-ID: <1384504535-29987-2-git-send-email-tianyu.lan@intel.com> (raw)
In-Reply-To: <1384504535-29987-1-git-send-email-tianyu.lan@intel.com>

Current, od_init() uses get_cpu_idle_time_us() to check whether
idle micro accouting is supported. The get_cpu_idle_time_us()
returns -1 only when tick nohz is disabled. This patch is to use
tick_nohz_check() directly to check nohz enable status instead of
get_cpu_idle_time_us(). This can avoid unnecessary getting and
putting cpu.

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
---
 drivers/cpufreq/cpufreq_ondemand.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index 18d4091..7db2468 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -475,8 +475,6 @@ static struct attribute_group od_attr_group_gov_pol = {
 static int od_init(struct dbs_data *dbs_data)
 {
 	struct od_dbs_tuners *tuners;
-	u64 idle_time;
-	int cpu;
 
 	tuners = kzalloc(sizeof(*tuners), GFP_KERNEL);
 	if (!tuners) {
@@ -484,10 +482,7 @@ static int od_init(struct dbs_data *dbs_data)
 		return -ENOMEM;
 	}
 
-	cpu = get_cpu();
-	idle_time = get_cpu_idle_time_us(cpu, NULL);
-	put_cpu();
-	if (idle_time != -1ULL) {
+	if (tick_nohz_check()) {
 		/* Idle micro accounting is supported. Use finer thresholds */
 		tuners->up_threshold = MICRO_FREQUENCY_UP_THRESHOLD;
 		/*
-- 
1.8.4.rc0.1.g8f6a3e5.dirty


  reply	other threads:[~2013-11-15  8:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-29  8:48 [PATCH 1/2] Tick: Introduce tick_nohz_check() to check nohz enable status Lan Tianyu
2013-10-29  8:48 ` [PATCH 2/2] Cpufreq/gov: use tick_nohz_check() to check idle micro accouting support Lan Tianyu
2013-10-29  9:51 ` [PATCH 1/2] Tick: Introduce tick_nohz_check() to check nohz enable status Paul E. McKenney
2013-10-29 10:29   ` Lan Tianyu
2013-11-04  3:13     ` Lan Tianyu
2013-11-04  9:52       ` Paul E. McKenney
2013-11-05  0:42         ` Lan Tianyu
2013-11-15  8:35 ` [PATCH V2 " Lan Tianyu
2013-11-15  8:35   ` Lan Tianyu [this message]
2013-11-15 10:36     ` [PATCH V2 2/2] Cpufreq/gov: use tick_nohz_check() to check idle micro accouting support Viresh Kumar
2013-11-15 10:35   ` [PATCH V2 1/2] Tick: Introduce tick_nohz_check() to check nohz enable status Viresh Kumar
2013-11-15 11:06   ` Thomas Gleixner

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=1384504535-29987-2-git-send-email-tianyu.lan@intel.com \
    --to=tianyu.lan@intel.com \
    --cc=cpufreq@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=viresh.kumar@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome