LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Nick Orlov <bugfixer@list.ru>
To: linux-kernel <linux-kernel@vger.kernel.org>, cpufreq@lists.linux.org.uk
Cc: Andrew Morton <akpm@osdl.org>, Dave Jones <davej@codemonkey.org.uk>
Subject: Re: [PATCH 2.6.18-rc6-mm1 2/2] cpufreq: make it harder for cpu to leave "hot" mode
Date: Mon, 11 Sep 2006 23:31:26 -0400 [thread overview]
Message-ID: <20060912033126.GC3677@nickolas.homeunix.com> (raw)
In-Reply-To: <20060912032924.GA3677@nickolas.homeunix.com>
From: Nick Orlov <bugfixer@list.ru>
Increase sampling period if cpu is running in "hot" mode.
Expose corresponding knob through sysfs.
Signed-off-by: Nick Orlov <bugfixer@list.ru>
--- linux-2.6.18-rc6/drivers/cpufreq/cpufreq_ondemand.c 2006-09-11 21:22:50.000000000 -0400
+++ linux-2.6.18-rc6-mm1-5.swp/drivers/cpufreq/cpufreq_ondemand.c 2006-09-11 20:49:10.000000000 -0400
@@ -39,6 +39,7 @@
* All times here are in uS.
*/
static unsigned int def_sampling_rate;
+static unsigned int def_sampling_rate_hot;
#define MIN_SAMPLING_RATE_RATIO (2)
/* for correct statistics, we need at least 10 ticks between each measure */
#define MIN_STAT_SAMPLING_RATE (MIN_SAMPLING_RATE_RATIO * jiffies_to_usecs(10))
@@ -46,6 +47,7 @@
#define MAX_SAMPLING_RATE (500 * def_sampling_rate)
#define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000)
#define TRANSITION_LATENCY_LIMIT (10 * 1000)
+#define DEF_SAMPLING_RATE_HOT_MULTIPLIER (10)
static void do_dbs_timer(void *data);
@@ -74,6 +76,7 @@
struct dbs_tuners {
unsigned int sampling_rate;
+ unsigned int sampling_rate_hot;
unsigned int up_threshold;
unsigned int ignore_nice;
};
@@ -122,6 +125,7 @@
return sprintf(buf, "%u\n", dbs_tuners_ins.object); \
}
show_one(sampling_rate, sampling_rate);
+show_one(sampling_rate_hot, sampling_rate_hot);
show_one(up_threshold, up_threshold);
show_one(ignore_nice_load, ignore_nice);
@@ -144,6 +148,25 @@
return count;
}
+static ssize_t store_sampling_rate_hot(struct cpufreq_policy *unused,
+ const char *buf, size_t count)
+{
+ unsigned int input;
+ int ret;
+ ret = sscanf(buf, "%u", &input);
+
+ mutex_lock(&dbs_mutex);
+ if (ret != 1 || input > MAX_SAMPLING_RATE || input < MIN_SAMPLING_RATE) {
+ mutex_unlock(&dbs_mutex);
+ return -EINVAL;
+ }
+
+ dbs_tuners_ins.sampling_rate_hot = input;
+ mutex_unlock(&dbs_mutex);
+
+ return count;
+}
+
static ssize_t store_up_threshold(struct cpufreq_policy *unused,
const char *buf, size_t count)
{
@@ -203,6 +226,7 @@
__ATTR(_name, 0644, show_##_name, store_##_name)
define_one_rw(sampling_rate);
+define_one_rw(sampling_rate_hot);
define_one_rw(up_threshold);
define_one_rw(ignore_nice_load);
@@ -210,6 +234,7 @@
&sampling_rate_max.attr,
&sampling_rate_min.attr,
&sampling_rate.attr,
+ &sampling_rate_hot.attr,
&up_threshold.attr,
&ignore_nice_load.attr,
NULL
@@ -305,6 +330,8 @@
{
unsigned int cpu = smp_processor_id();
struct cpu_dbs_info_s *dbs_info = &per_cpu(cpu_dbs_info, cpu);
+ struct cpufreq_policy *policy;
+ unsigned int sampling_rate;
if (!dbs_info->enable)
return;
@@ -312,8 +339,14 @@
lock_cpu_hotplug();
dbs_check_cpu(dbs_info);
unlock_cpu_hotplug();
+
+ policy = dbs_info->cur_policy;
+ sampling_rate = (policy->cur == policy->max)
+ ? dbs_tuners_ins.sampling_rate_hot
+ : dbs_tuners_ins.sampling_rate;
+
queue_delayed_work_on(cpu, kondemand_wq, &dbs_info->work,
- usecs_to_jiffies(dbs_tuners_ins.sampling_rate));
+ usecs_to_jiffies(sampling_rate));
}
static inline void dbs_timer_init(unsigned int cpu)
@@ -394,7 +427,14 @@
if (def_sampling_rate < MIN_STAT_SAMPLING_RATE)
def_sampling_rate = MIN_STAT_SAMPLING_RATE;
+ def_sampling_rate_hot = def_sampling_rate *
+ DEF_SAMPLING_RATE_HOT_MULTIPLIER;
+
+ WARN_ON(def_sampling_rate_hot > MAX_SAMPLING_RATE);
+
dbs_tuners_ins.sampling_rate = def_sampling_rate;
+ dbs_tuners_ins.sampling_rate_hot =
+ def_sampling_rate_hot;
}
dbs_timer_init(policy->cpu);
_
--
With best wishes,
Nick Orlov.
next prev parent reply other threads:[~2006-09-12 3:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-12 3:29 [PATCH 2.6.18-rc6-mm1 0/2] " Nick Orlov
2006-09-12 3:30 ` [PATCH 2.6.18-rc6-mm1 1/2] " Nick Orlov
2006-09-12 3:31 ` Nick Orlov [this message]
2006-09-12 20:05 ` [PATCH 2.6.18-rc6-mm1 0/2] " Venkatesh Pallipadi
2006-09-14 4:48 ` Nick Orlov
2006-09-14 21:38 ` Andrew Morton
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=20060912033126.GC3677@nickolas.homeunix.com \
--to=bugfixer@list.ru \
--cc=akpm@osdl.org \
--cc=cpufreq@lists.linux.org.uk \
--cc=davej@codemonkey.org.uk \
--cc=linux-kernel@vger.kernel.org \
--subject='Re: [PATCH 2.6.18-rc6-mm1 2/2] cpufreq: make it harder for cpu to leave "hot" mode' \
/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
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).