Commit 9c7d269b authored by Dave Jones's avatar Dave Jones

[CPUFREQ] ondemand,conservative governor idle_tick clean-up

[PATCH] [3/5] ondemand,conservative governor idle_tick clean-up

Ondemand and conservative governor clean-up, it factorises the idle ticks 
measurement.
Signed-off-by: default avatarEric Piel <eric.piel@tremplin-utc.net>
Signed-off-by: default avatarVenkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: default avatarDave Jones <davej@redhat.com>
parent 790d76fa
...@@ -297,7 +297,6 @@ static struct attribute_group dbs_attr_group = { ...@@ -297,7 +297,6 @@ static struct attribute_group dbs_attr_group = {
static void dbs_check_cpu(int cpu) static void dbs_check_cpu(int cpu)
{ {
unsigned int idle_ticks, up_idle_ticks, down_idle_ticks; unsigned int idle_ticks, up_idle_ticks, down_idle_ticks;
unsigned int total_idle_ticks;
unsigned int freq_step; unsigned int freq_step;
unsigned int freq_down_sampling_rate; unsigned int freq_down_sampling_rate;
static int down_skip[NR_CPUS]; static int down_skip[NR_CPUS];
...@@ -338,19 +337,12 @@ static void dbs_check_cpu(int cpu) ...@@ -338,19 +337,12 @@ static void dbs_check_cpu(int cpu)
*/ */
/* Check for frequency increase */ /* Check for frequency increase */
total_idle_ticks = get_cpu_idle_time(cpu);
idle_ticks = total_idle_ticks -
this_dbs_info->prev_cpu_idle_up;
this_dbs_info->prev_cpu_idle_up = total_idle_ticks;
idle_ticks = UINT_MAX;
for_each_cpu_mask(j, policy->cpus) { for_each_cpu_mask(j, policy->cpus) {
unsigned int tmp_idle_ticks; unsigned int tmp_idle_ticks, total_idle_ticks;
struct cpu_dbs_info_s *j_dbs_info; struct cpu_dbs_info_s *j_dbs_info;
if (j == cpu)
continue;
j_dbs_info = &per_cpu(cpu_dbs_info, j); j_dbs_info = &per_cpu(cpu_dbs_info, j);
/* Check for frequency increase */ /* Check for frequency increase */
total_idle_ticks = get_cpu_idle_time(j); total_idle_ticks = get_cpu_idle_time(j);
...@@ -400,20 +392,12 @@ static void dbs_check_cpu(int cpu) ...@@ -400,20 +392,12 @@ static void dbs_check_cpu(int cpu)
if (down_skip[cpu] < dbs_tuners_ins.sampling_down_factor) if (down_skip[cpu] < dbs_tuners_ins.sampling_down_factor)
return; return;
total_idle_ticks = this_dbs_info->prev_cpu_idle_up; idle_ticks = UINT_MAX;
idle_ticks = total_idle_ticks -
this_dbs_info->prev_cpu_idle_down;
this_dbs_info->prev_cpu_idle_down = total_idle_ticks;
for_each_cpu_mask(j, policy->cpus) { for_each_cpu_mask(j, policy->cpus) {
unsigned int tmp_idle_ticks; unsigned int tmp_idle_ticks, total_idle_ticks;
struct cpu_dbs_info_s *j_dbs_info; struct cpu_dbs_info_s *j_dbs_info;
if (j == cpu)
continue;
j_dbs_info = &per_cpu(cpu_dbs_info, j); j_dbs_info = &per_cpu(cpu_dbs_info, j);
/* Check for frequency increase */
total_idle_ticks = j_dbs_info->prev_cpu_idle_up; total_idle_ticks = j_dbs_info->prev_cpu_idle_up;
tmp_idle_ticks = total_idle_ticks - tmp_idle_ticks = total_idle_ticks -
j_dbs_info->prev_cpu_idle_down; j_dbs_info->prev_cpu_idle_down;
...@@ -432,7 +416,7 @@ static void dbs_check_cpu(int cpu) ...@@ -432,7 +416,7 @@ static void dbs_check_cpu(int cpu)
down_idle_ticks = (100 - dbs_tuners_ins.down_threshold) * down_idle_ticks = (100 - dbs_tuners_ins.down_threshold) *
usecs_to_jiffies(freq_down_sampling_rate); usecs_to_jiffies(freq_down_sampling_rate);
if (idle_ticks > down_idle_ticks ) { if (idle_ticks > down_idle_ticks) {
/* if we are already at the lowest speed then break out early /* if we are already at the lowest speed then break out early
* or if we 'cannot' reduce the speed as the user might want * or if we 'cannot' reduce the speed as the user might want
* freq_step to be zero */ * freq_step to be zero */
......
...@@ -296,7 +296,6 @@ static struct attribute_group dbs_attr_group = { ...@@ -296,7 +296,6 @@ static struct attribute_group dbs_attr_group = {
static void dbs_check_cpu(int cpu) static void dbs_check_cpu(int cpu)
{ {
unsigned int idle_ticks, up_idle_ticks, down_idle_ticks; unsigned int idle_ticks, up_idle_ticks, down_idle_ticks;
unsigned int total_idle_ticks;
unsigned int freq_down_step; unsigned int freq_down_step;
unsigned int freq_down_sampling_rate; unsigned int freq_down_sampling_rate;
static int down_skip[NR_CPUS]; static int down_skip[NR_CPUS];
...@@ -325,20 +324,12 @@ static void dbs_check_cpu(int cpu) ...@@ -325,20 +324,12 @@ static void dbs_check_cpu(int cpu)
*/ */
/* Check for frequency increase */ /* Check for frequency increase */
total_idle_ticks = get_cpu_idle_time(cpu); idle_ticks = UINT_MAX;
idle_ticks = total_idle_ticks -
this_dbs_info->prev_cpu_idle_up;
this_dbs_info->prev_cpu_idle_up = total_idle_ticks;
for_each_cpu_mask(j, policy->cpus) { for_each_cpu_mask(j, policy->cpus) {
unsigned int tmp_idle_ticks; unsigned int tmp_idle_ticks, total_idle_ticks;
struct cpu_dbs_info_s *j_dbs_info; struct cpu_dbs_info_s *j_dbs_info;
if (j == cpu)
continue;
j_dbs_info = &per_cpu(cpu_dbs_info, j); j_dbs_info = &per_cpu(cpu_dbs_info, j);
/* Check for frequency increase */
total_idle_ticks = get_cpu_idle_time(j); total_idle_ticks = get_cpu_idle_time(j);
tmp_idle_ticks = total_idle_ticks - tmp_idle_ticks = total_idle_ticks -
j_dbs_info->prev_cpu_idle_up; j_dbs_info->prev_cpu_idle_up;
...@@ -376,18 +367,11 @@ static void dbs_check_cpu(int cpu) ...@@ -376,18 +367,11 @@ static void dbs_check_cpu(int cpu)
if (down_skip[cpu] < dbs_tuners_ins.sampling_down_factor) if (down_skip[cpu] < dbs_tuners_ins.sampling_down_factor)
return; return;
total_idle_ticks = this_dbs_info->prev_cpu_idle_up; idle_ticks = UINT_MAX;
idle_ticks = total_idle_ticks -
this_dbs_info->prev_cpu_idle_down;
this_dbs_info->prev_cpu_idle_down = total_idle_ticks;
for_each_cpu_mask(j, policy->cpus) { for_each_cpu_mask(j, policy->cpus) {
unsigned int tmp_idle_ticks; unsigned int tmp_idle_ticks, total_idle_ticks;
struct cpu_dbs_info_s *j_dbs_info; struct cpu_dbs_info_s *j_dbs_info;
if (j == cpu)
continue;
j_dbs_info = &per_cpu(cpu_dbs_info, j); j_dbs_info = &per_cpu(cpu_dbs_info, j);
/* Check for frequency decrease */ /* Check for frequency decrease */
total_idle_ticks = j_dbs_info->prev_cpu_idle_up; total_idle_ticks = j_dbs_info->prev_cpu_idle_up;
...@@ -408,7 +392,7 @@ static void dbs_check_cpu(int cpu) ...@@ -408,7 +392,7 @@ static void dbs_check_cpu(int cpu)
down_idle_ticks = (100 - dbs_tuners_ins.down_threshold) * down_idle_ticks = (100 - dbs_tuners_ins.down_threshold) *
usecs_to_jiffies(freq_down_sampling_rate); usecs_to_jiffies(freq_down_sampling_rate);
if (idle_ticks > down_idle_ticks ) { if (idle_ticks > down_idle_ticks) {
/* if we are already at the lowest speed then break out early /* if we are already at the lowest speed then break out early
* or if we 'cannot' reduce the speed as the user might want * or if we 'cannot' reduce the speed as the user might want
* freq_step to be zero */ * freq_step to be zero */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment