diff options
Diffstat (limited to 'drivers/cpufreq/cpufreq_conservative.c')
-rw-r--r-- | drivers/cpufreq/cpufreq_conservative.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index 5ef5ede5b88..eef0270c6f3 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c | |||
@@ -44,15 +44,17 @@ | |||
44 | * latency of the processor. The governor will work on any processor with | 44 | * latency of the processor. The governor will work on any processor with |
45 | * transition latency <= 10mS, using appropriate sampling | 45 | * transition latency <= 10mS, using appropriate sampling |
46 | * rate. | 46 | * rate. |
47 | * For CPUs with transition latency > 10mS (mostly drivers with CPUFREQ_ETERNAL) | 47 | * For CPUs with transition latency > 10mS (mostly drivers |
48 | * this governor will not work. | 48 | * with CPUFREQ_ETERNAL), this governor will not work. |
49 | * All times here are in uS. | 49 | * All times here are in uS. |
50 | */ | 50 | */ |
51 | static unsigned int def_sampling_rate; | 51 | static unsigned int def_sampling_rate; |
52 | #define MIN_SAMPLING_RATE_RATIO (2) | 52 | #define MIN_SAMPLING_RATE_RATIO (2) |
53 | /* for correct statistics, we need at least 10 ticks between each measure */ | 53 | /* for correct statistics, we need at least 10 ticks between each measure */ |
54 | #define MIN_STAT_SAMPLING_RATE (MIN_SAMPLING_RATE_RATIO * jiffies_to_usecs(10)) | 54 | #define MIN_STAT_SAMPLING_RATE \ |
55 | #define MIN_SAMPLING_RATE (def_sampling_rate / MIN_SAMPLING_RATE_RATIO) | 55 | (MIN_SAMPLING_RATE_RATIO * jiffies_to_usecs(10)) |
56 | #define MIN_SAMPLING_RATE \ | ||
57 | (def_sampling_rate / MIN_SAMPLING_RATE_RATIO) | ||
56 | #define MAX_SAMPLING_RATE (500 * def_sampling_rate) | 58 | #define MAX_SAMPLING_RATE (500 * def_sampling_rate) |
57 | #define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000) | 59 | #define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000) |
58 | #define DEF_SAMPLING_DOWN_FACTOR (1) | 60 | #define DEF_SAMPLING_DOWN_FACTOR (1) |
@@ -103,11 +105,16 @@ static struct dbs_tuners dbs_tuners_ins = { | |||
103 | 105 | ||
104 | static inline unsigned int get_cpu_idle_time(unsigned int cpu) | 106 | static inline unsigned int get_cpu_idle_time(unsigned int cpu) |
105 | { | 107 | { |
106 | return kstat_cpu(cpu).cpustat.idle + | 108 | unsigned int add_nice = 0, ret; |
109 | |||
110 | if (dbs_tuners_ins.ignore_nice) | ||
111 | add_nice = kstat_cpu(cpu).cpustat.nice; | ||
112 | |||
113 | ret = kstat_cpu(cpu).cpustat.idle + | ||
107 | kstat_cpu(cpu).cpustat.iowait + | 114 | kstat_cpu(cpu).cpustat.iowait + |
108 | ( dbs_tuners_ins.ignore_nice ? | 115 | add_nice; |
109 | kstat_cpu(cpu).cpustat.nice : | 116 | |
110 | 0); | 117 | return ret; |
111 | } | 118 | } |
112 | 119 | ||
113 | /************************** sysfs interface ************************/ | 120 | /************************** sysfs interface ************************/ |
@@ -452,6 +459,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
452 | unsigned int cpu = policy->cpu; | 459 | unsigned int cpu = policy->cpu; |
453 | struct cpu_dbs_info_s *this_dbs_info; | 460 | struct cpu_dbs_info_s *this_dbs_info; |
454 | unsigned int j; | 461 | unsigned int j; |
462 | int rc; | ||
455 | 463 | ||
456 | this_dbs_info = &per_cpu(cpu_dbs_info, cpu); | 464 | this_dbs_info = &per_cpu(cpu_dbs_info, cpu); |
457 | 465 | ||
@@ -468,6 +476,13 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
468 | break; | 476 | break; |
469 | 477 | ||
470 | mutex_lock(&dbs_mutex); | 478 | mutex_lock(&dbs_mutex); |
479 | |||
480 | rc = sysfs_create_group(&policy->kobj, &dbs_attr_group); | ||
481 | if (rc) { | ||
482 | mutex_unlock(&dbs_mutex); | ||
483 | return rc; | ||
484 | } | ||
485 | |||
471 | for_each_cpu_mask(j, policy->cpus) { | 486 | for_each_cpu_mask(j, policy->cpus) { |
472 | struct cpu_dbs_info_s *j_dbs_info; | 487 | struct cpu_dbs_info_s *j_dbs_info; |
473 | j_dbs_info = &per_cpu(cpu_dbs_info, j); | 488 | j_dbs_info = &per_cpu(cpu_dbs_info, j); |
@@ -480,7 +495,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
480 | this_dbs_info->enable = 1; | 495 | this_dbs_info->enable = 1; |
481 | this_dbs_info->down_skip = 0; | 496 | this_dbs_info->down_skip = 0; |
482 | this_dbs_info->requested_freq = policy->cur; | 497 | this_dbs_info->requested_freq = policy->cur; |
483 | sysfs_create_group(&policy->kobj, &dbs_attr_group); | 498 | |
484 | dbs_enable++; | 499 | dbs_enable++; |
485 | /* | 500 | /* |
486 | * Start the timerschedule work, when this governor | 501 | * Start the timerschedule work, when this governor |