linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Rafael Wysocki <rjw@rjwysocki.net>
Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org,
	preeti.lkml@gmail.com, Viresh Kumar <viresh.kumar@linaro.org>,
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH V2 7/9] cpufreq: ondemand: update sampling rate immidiately
Date: Mon, 27 Jul 2015 17:58:12 +0530	[thread overview]
Message-ID: <d6363924f02d389ce50ed1a08450d2ff2d1800c1.1437999691.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <cover.1437999691.git.viresh.kumar@linaro.org>
In-Reply-To: <cover.1437999691.git.viresh.kumar@linaro.org>

We are immediately updating sampling rate for already queued-works, only
if the new expiry is lesser than the old one.

But what about the case, where the user doesn't want frequent events and
want to increase sampling time? Shouldn't we cancel the works (and so
their interrupts) on all policy->cpus (which might occur very shortly).

This patch removes this special case and simplifies code by immediately
updating the expiry.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/cpufreq_ondemand.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index a6f579e40ce2..1a6f84b42441 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -231,17 +231,8 @@ static unsigned int od_dbs_timer(struct cpu_dbs_info *cdbs,
 static struct common_dbs_data od_dbs_cdata;
 
 /**
- * update_sampling_rate - update sampling rate effective immediately if needed.
+ * update_sampling_rate - update sampling rate immediately.
  * @new_rate: new sampling rate
- *
- * If new rate is smaller than the old, simply updating
- * dbs_tuners_int.sampling_rate might not be appropriate. For example, if the
- * original sampling_rate was 1 second and the requested new sampling rate is 10
- * ms because the user needs immediate reaction from ondemand governor, but not
- * sure if higher frequency will be required or not, then, the governor may
- * change the sampling rate too late; up to 1 second later. Thus, if we are
- * reducing the sampling rate, we need to make the new value effective
- * immediately.
  */
 static void update_sampling_rate(struct dbs_data *dbs_data,
 		unsigned int new_rate)
@@ -249,7 +240,6 @@ static void update_sampling_rate(struct dbs_data *dbs_data,
 	struct od_dbs_tuners *od_tuners = dbs_data->tuners;
 	struct cpufreq_policy *policy;
 	struct od_cpu_dbs_info_s *dbs_info;
-	unsigned long next_sampling, appointed_at;
 	struct cpumask cpumask;
 	int cpu;
 
@@ -278,12 +268,6 @@ static void update_sampling_rate(struct dbs_data *dbs_data,
 		if (!dbs_info->cdbs.shared->policy)
 			continue;
 
-		next_sampling = jiffies + usecs_to_jiffies(new_rate);
-		appointed_at = dbs_info->cdbs.dwork.timer.expires;
-
-		if (!time_before(next_sampling, appointed_at))
-			continue;
-
 		gov_queue_work(dbs_data, policy, usecs_to_jiffies(new_rate),
 			       policy->cpus);
 	}
-- 
2.4.0


  parent reply	other threads:[~2015-07-27 12:29 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1437999691.git.viresh.kumar@linaro.org>
2015-07-27 12:28 ` [PATCH V2 1/9] cpufreq: Use __func__ to print function's name Viresh Kumar
2015-09-07 23:42   ` Rafael J. Wysocki
2015-07-27 12:28 ` [PATCH V2 2/9] cpufreq: conservative: remove 'enable' field Viresh Kumar
2015-09-08  0:17   ` Rafael J. Wysocki
2015-09-08  1:33     ` Viresh Kumar
2015-09-08  1:40     ` [PATCH V3 " Viresh Kumar
2015-07-27 12:28 ` [PATCH V2 3/9] cpufreq: ondemand: only queue canceled works from update_sampling_rate() Viresh Kumar
2015-09-08  1:11   ` Rafael J. Wysocki
2015-09-08  1:58     ` Viresh Kumar
2015-09-09  1:06       ` Rafael J. Wysocki
2015-09-09  2:30         ` Viresh Kumar
2015-09-09 20:10           ` Rafael J. Wysocki
2015-07-27 12:28 ` [PATCH V2 4/9] cpufreq: governor: Drop __gov_queue_work() Viresh Kumar
2015-09-08  1:15   ` Rafael J. Wysocki
2015-09-08  2:00     ` Viresh Kumar
2015-09-09  1:04       ` Rafael J. Wysocki
2015-07-27 12:28 ` [PATCH V2 5/9] cpufreq: ondemand: Drop unnecessary locks from update_sampling_rate() Viresh Kumar
2015-07-27 12:28 ` [PATCH V2 6/9] cpufreq: ondemand: queue work for policy->cpus together Viresh Kumar
2015-09-08  1:33   ` Rafael J. Wysocki
2015-09-08  2:11     ` Viresh Kumar
2015-09-08  2:13       ` Viresh Kumar
2015-07-27 12:28 ` Viresh Kumar [this message]
2015-07-27 12:28 ` [PATCH V2 8/9] cpufreq: governor: Quit work-handlers early if governor is stopped Viresh Kumar
2015-07-27 12:28 ` [PATCH V2 9/9] cpufreq: Get rid of ->governor_enabled and its lock Viresh Kumar

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=d6363924f02d389ce50ed1a08450d2ff2d1800c1.1437999691.git.viresh.kumar@linaro.org \
    --to=viresh.kumar@linaro.org \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=preeti.lkml@gmail.com \
    --cc=rjw@rjwysocki.net \
    /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;
as well as URLs for NNTP newsgroup(s).