Skip to content

Commit

Permalink
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/…
Browse files Browse the repository at this point in the history
…davej/cpufreq

* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq:
  [CPUFREQ] pcc-cpufreq: remove duplicate statements
  [CPUFREQ] Remove the pm_message_t argument from driver suspend
  [CPUFREQ] Remove unneeded locks
  [CPUFREQ] Remove old, deprecated per cpu ondemand/conservative sysfs files
  [CPUFREQ] Remove deprecated sysfs file sampling_rate_max
  [CPUFREQ] powernow-k8: The table index is not worth displaying
  [CPUFREQ] calculate delay after dbs_check_cpu
  [CPUFREQ] Add documentation for sampling_down_factor
  [CPUFREQ] drivers/cpufreq: Remove unnecessary semicolons
  • Loading branch information
Linus Torvalds committed Mar 18, 2011
2 parents 77aa56b + bdce259 commit 61ef46f
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 248 deletions.
11 changes: 11 additions & 0 deletions Documentation/cpu-freq/governors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,17 @@ intensive calculation on your laptop that you do not care how long it
takes to complete as you can 'nice' it and prevent it from taking part
in the deciding process of whether to increase your CPU frequency.

sampling_down_factor: this parameter controls the rate at which the
kernel makes a decision on when to decrease the frequency while running
at top speed. When set to 1 (the default) decisions to reevaluate load
are made at the same interval regardless of current clock speed. But
when set to greater than 1 (e.g. 100) it acts as a multiplier for the
scheduling interval for reevaluating load when the CPU is at its top
speed due to high load. This improves performance by reducing the overhead
of load evaluation and helping the CPU stay at its top speed when truly
busy, rather than shifting back and forth in speed. This tunable has no
effect on behavior at lower speeds/lower CPU loads.


2.5 Conservative
----------------
Expand Down
3 changes: 1 addition & 2 deletions arch/arm/mach-s5pv210/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,7 @@ static int s5pv210_target(struct cpufreq_policy *policy,
}

#ifdef CONFIG_PM
static int s5pv210_cpufreq_suspend(struct cpufreq_policy *policy,
pm_message_t pmsg)
static int s5pv210_cpufreq_suspend(struct cpufreq_policy *policy)
{
return 0;
}
Expand Down
3 changes: 1 addition & 2 deletions arch/arm/mach-s5pv310/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,7 @@ static int s5pv310_target(struct cpufreq_policy *policy,
}

#ifdef CONFIG_PM
static int s5pv310_cpufreq_suspend(struct cpufreq_policy *policy,
pm_message_t pmsg)
static int s5pv310_cpufreq_suspend(struct cpufreq_policy *policy)
{
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/plat-s3c24xx/cpu-freq.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ static int s3c_cpufreq_verify(struct cpufreq_policy *policy)
static struct cpufreq_frequency_table suspend_pll;
static unsigned int suspend_freq;

static int s3c_cpufreq_suspend(struct cpufreq_policy *policy, pm_message_t pmsg)
static int s3c_cpufreq_suspend(struct cpufreq_policy *policy)
{
suspend_pll.frequency = clk_get_rate(_clk_mpll);
suspend_pll.index = __raw_readl(S3C2410_MPLLCON);
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/powermac/cpufreq_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ static u32 read_gpio(struct device_node *np)
return offset;
}

static int pmac_cpufreq_suspend(struct cpufreq_policy *policy, pm_message_t pmsg)
static int pmac_cpufreq_suspend(struct cpufreq_policy *policy)
{
/* Ok, this could be made a bit smarter, but let's be robust for now. We
* always force a speed change to high speed before sleep, to make sure
Expand Down
2 changes: 0 additions & 2 deletions arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,6 @@ static int __init pcc_cpufreq_do_osc(acpi_handle *handle)
u32 supported;
int ret = 0;

input.count = 4;
input.pointer = in_params;
input.count = 4;
input.pointer = in_params;
in_params[0].type = ACPI_TYPE_BUFFER;
Expand Down
3 changes: 1 addition & 2 deletions arch/x86/kernel/cpu/cpufreq/powernow-k8.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,8 +630,7 @@ static void print_basics(struct powernow_k8_data *data)
data->powernow_table[j].frequency/1000);
} else {
printk(KERN_INFO PFX
" %d : fid 0x%x (%d MHz), vid 0x%x\n",
j,
"fid 0x%x (%d MHz), vid 0x%x\n",
data->powernow_table[j].index & 0xff,
data->powernow_table[j].frequency/1000,
data->powernow_table[j].index >> 8);
Expand Down
2 changes: 1 addition & 1 deletion drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1371,7 +1371,7 @@ static int cpufreq_suspend(struct sys_device *sysdev, pm_message_t pmsg)
goto out;

if (cpufreq_driver->suspend) {
ret = cpufreq_driver->suspend(cpu_policy, pmsg);
ret = cpufreq_driver->suspend(cpu_policy);
if (ret)
printk(KERN_ERR "cpufreq: suspend failed in ->suspend "
"step on CPU %u\n", cpu_policy->cpu);
Expand Down
123 changes: 6 additions & 117 deletions drivers/cpufreq/cpufreq_conservative.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ static DEFINE_PER_CPU(struct cpu_dbs_info_s, cs_cpu_dbs_info);
static unsigned int dbs_enable; /* number of CPUs using this policy */

/*
* dbs_mutex protects data in dbs_tuners_ins from concurrent changes on
* different CPUs. It protects dbs_enable in governor start/stop.
* dbs_mutex protects dbs_enable in governor start/stop.
*/
static DEFINE_MUTEX(dbs_mutex);

Expand Down Expand Up @@ -116,7 +115,7 @@ static inline cputime64_t get_cpu_idle_time_jiffy(unsigned int cpu,
if (wall)
*wall = (cputime64_t)jiffies_to_usecs(cur_wall_time);

return (cputime64_t)jiffies_to_usecs(idle_time);;
return (cputime64_t)jiffies_to_usecs(idle_time);
}

static inline cputime64_t get_cpu_idle_time(unsigned int cpu, cputime64_t *wall)
Expand Down Expand Up @@ -162,21 +161,12 @@ static struct notifier_block dbs_cpufreq_notifier_block = {
};

/************************** sysfs interface ************************/
static ssize_t show_sampling_rate_max(struct kobject *kobj,
struct attribute *attr, char *buf)
{
printk_once(KERN_INFO "CPUFREQ: conservative sampling_rate_max "
"sysfs file is deprecated - used by: %s\n", current->comm);
return sprintf(buf, "%u\n", -1U);
}

static ssize_t show_sampling_rate_min(struct kobject *kobj,
struct attribute *attr, char *buf)
{
return sprintf(buf, "%u\n", min_sampling_rate);
}

define_one_global_ro(sampling_rate_max);
define_one_global_ro(sampling_rate_min);

/* cpufreq_conservative Governor Tunables */
Expand All @@ -193,33 +183,6 @@ show_one(down_threshold, down_threshold);
show_one(ignore_nice_load, ignore_nice);
show_one(freq_step, freq_step);

/*** delete after deprecation time ***/
#define DEPRECATION_MSG(file_name) \
printk_once(KERN_INFO "CPUFREQ: Per core conservative sysfs " \
"interface is deprecated - " #file_name "\n");

#define show_one_old(file_name) \
static ssize_t show_##file_name##_old \
(struct cpufreq_policy *unused, char *buf) \
{ \
printk_once(KERN_INFO "CPUFREQ: Per core conservative sysfs " \
"interface is deprecated - " #file_name "\n"); \
return show_##file_name(NULL, NULL, buf); \
}
show_one_old(sampling_rate);
show_one_old(sampling_down_factor);
show_one_old(up_threshold);
show_one_old(down_threshold);
show_one_old(ignore_nice_load);
show_one_old(freq_step);
show_one_old(sampling_rate_min);
show_one_old(sampling_rate_max);

cpufreq_freq_attr_ro_old(sampling_rate_min);
cpufreq_freq_attr_ro_old(sampling_rate_max);

/*** delete after deprecation time ***/

static ssize_t store_sampling_down_factor(struct kobject *a,
struct attribute *b,
const char *buf, size_t count)
Expand All @@ -231,10 +194,7 @@ static ssize_t store_sampling_down_factor(struct kobject *a,
if (ret != 1 || input > MAX_SAMPLING_DOWN_FACTOR || input < 1)
return -EINVAL;

mutex_lock(&dbs_mutex);
dbs_tuners_ins.sampling_down_factor = input;
mutex_unlock(&dbs_mutex);

return count;
}

Expand All @@ -248,10 +208,7 @@ static ssize_t store_sampling_rate(struct kobject *a, struct attribute *b,
if (ret != 1)
return -EINVAL;

mutex_lock(&dbs_mutex);
dbs_tuners_ins.sampling_rate = max(input, min_sampling_rate);
mutex_unlock(&dbs_mutex);

return count;
}

Expand All @@ -262,16 +219,11 @@ static ssize_t store_up_threshold(struct kobject *a, struct attribute *b,
int ret;
ret = sscanf(buf, "%u", &input);

mutex_lock(&dbs_mutex);
if (ret != 1 || input > 100 ||
input <= dbs_tuners_ins.down_threshold) {
mutex_unlock(&dbs_mutex);
input <= dbs_tuners_ins.down_threshold)
return -EINVAL;
}

dbs_tuners_ins.up_threshold = input;
mutex_unlock(&dbs_mutex);

return count;
}

Expand All @@ -282,17 +234,12 @@ static ssize_t store_down_threshold(struct kobject *a, struct attribute *b,
int ret;
ret = sscanf(buf, "%u", &input);

mutex_lock(&dbs_mutex);
/* cannot be lower than 11 otherwise freq will not fall */
if (ret != 1 || input < 11 || input > 100 ||
input >= dbs_tuners_ins.up_threshold) {
mutex_unlock(&dbs_mutex);
input >= dbs_tuners_ins.up_threshold)
return -EINVAL;
}

dbs_tuners_ins.down_threshold = input;
mutex_unlock(&dbs_mutex);

return count;
}

Expand All @@ -311,11 +258,9 @@ static ssize_t store_ignore_nice_load(struct kobject *a, struct attribute *b,
if (input > 1)
input = 1;

mutex_lock(&dbs_mutex);
if (input == dbs_tuners_ins.ignore_nice) { /* nothing to do */
mutex_unlock(&dbs_mutex);
if (input == dbs_tuners_ins.ignore_nice) /* nothing to do */
return count;
}

dbs_tuners_ins.ignore_nice = input;

/* we need to re-evaluate prev_cpu_idle */
Expand All @@ -327,8 +272,6 @@ static ssize_t store_ignore_nice_load(struct kobject *a, struct attribute *b,
if (dbs_tuners_ins.ignore_nice)
dbs_info->prev_cpu_nice = kstat_cpu(j).cpustat.nice;
}
mutex_unlock(&dbs_mutex);

return count;
}

Expand All @@ -347,10 +290,7 @@ static ssize_t store_freq_step(struct kobject *a, struct attribute *b,

/* no need to test here if freq_step is zero as the user might actually
* want this, they would be crazy though :) */
mutex_lock(&dbs_mutex);
dbs_tuners_ins.freq_step = input;
mutex_unlock(&dbs_mutex);

return count;
}

Expand All @@ -362,7 +302,6 @@ define_one_global_rw(ignore_nice_load);
define_one_global_rw(freq_step);

static struct attribute *dbs_attributes[] = {
&sampling_rate_max.attr,
&sampling_rate_min.attr,
&sampling_rate.attr,
&sampling_down_factor.attr,
Expand All @@ -378,49 +317,6 @@ static struct attribute_group dbs_attr_group = {
.name = "conservative",
};

/*** delete after deprecation time ***/

#define write_one_old(file_name) \
static ssize_t store_##file_name##_old \
(struct cpufreq_policy *unused, const char *buf, size_t count) \
{ \
printk_once(KERN_INFO "CPUFREQ: Per core conservative sysfs " \
"interface is deprecated - " #file_name "\n"); \
return store_##file_name(NULL, NULL, buf, count); \
}
write_one_old(sampling_rate);
write_one_old(sampling_down_factor);
write_one_old(up_threshold);
write_one_old(down_threshold);
write_one_old(ignore_nice_load);
write_one_old(freq_step);

cpufreq_freq_attr_rw_old(sampling_rate);
cpufreq_freq_attr_rw_old(sampling_down_factor);
cpufreq_freq_attr_rw_old(up_threshold);
cpufreq_freq_attr_rw_old(down_threshold);
cpufreq_freq_attr_rw_old(ignore_nice_load);
cpufreq_freq_attr_rw_old(freq_step);

static struct attribute *dbs_attributes_old[] = {
&sampling_rate_max_old.attr,
&sampling_rate_min_old.attr,
&sampling_rate_old.attr,
&sampling_down_factor_old.attr,
&up_threshold_old.attr,
&down_threshold_old.attr,
&ignore_nice_load_old.attr,
&freq_step_old.attr,
NULL
};

static struct attribute_group dbs_attr_group_old = {
.attrs = dbs_attributes_old,
.name = "conservative",
};

/*** delete after deprecation time ***/

/************************** sysfs end ************************/

static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
Expand Down Expand Up @@ -596,12 +492,6 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,

mutex_lock(&dbs_mutex);

rc = sysfs_create_group(&policy->kobj, &dbs_attr_group_old);
if (rc) {
mutex_unlock(&dbs_mutex);
return rc;
}

for_each_cpu(j, policy->cpus) {
struct cpu_dbs_info_s *j_dbs_info;
j_dbs_info = &per_cpu(cs_cpu_dbs_info, j);
Expand Down Expand Up @@ -664,7 +554,6 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
dbs_timer_exit(this_dbs_info);

mutex_lock(&dbs_mutex);
sysfs_remove_group(&policy->kobj, &dbs_attr_group_old);
dbs_enable--;
mutex_destroy(&this_dbs_info->timer_mutex);

Expand Down
Loading

0 comments on commit 61ef46f

Please sign in to comment.