diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-28 12:48:32 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-28 12:48:32 -0500 |
commit | 9561b03dc360068504cb296d325fb84295f91fbb (patch) | |
tree | b241c43d203f99f2ce21c9edf81aa7f71ac57025 | |
parent | 7baf398f12585ae77748716fa77113c1f1831153 (diff) | |
parent | c326e27eb79e98050d855e371ac534ff4352e910 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq
* master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq:
[CPUFREQ] cpufreq_conservative: keep ignore_nice_load and freq_step values when reselected
[CPUFREQ] powernow: remove private for_each_cpu_mask()
[CPUFREQ] hotplug cpu fix for powernow-k8
[PATCH] cpufreq_ondemand: add range check
[PATCH] cpufreq_ondemand: keep ignore_nice_load value when it is reselected
[PATCH] cpufreq_ondemand: Warn if it cannot run due to too long transition latency
[PATCH] cpufreq_conservative: alternative initialise approach
[PATCH] cpufreq_conservative: make for_each_cpu() safe
[PATCH] cpufreq_conservative: alter default responsiveness
[PATCH] cpufreq_conservative: aligning of codebase with ondemand
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/powernow-k8.c | 7 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/powernow-k8.h | 4 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq_conservative.c | 155 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq_ondemand.c | 11 |
4 files changed, 79 insertions, 98 deletions
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c index 1e70823e1cb5..712a26bd4457 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c | |||
@@ -1095,10 +1095,15 @@ static int __devexit powernowk8_cpu_exit (struct cpufreq_policy *pol) | |||
1095 | 1095 | ||
1096 | static unsigned int powernowk8_get (unsigned int cpu) | 1096 | static unsigned int powernowk8_get (unsigned int cpu) |
1097 | { | 1097 | { |
1098 | struct powernow_k8_data *data = powernow_data[cpu]; | 1098 | struct powernow_k8_data *data; |
1099 | cpumask_t oldmask = current->cpus_allowed; | 1099 | cpumask_t oldmask = current->cpus_allowed; |
1100 | unsigned int khz = 0; | 1100 | unsigned int khz = 0; |
1101 | 1101 | ||
1102 | data = powernow_data[first_cpu(cpu_core_map[cpu])]; | ||
1103 | |||
1104 | if (!data) | ||
1105 | return -EINVAL; | ||
1106 | |||
1102 | set_cpus_allowed(current, cpumask_of_cpu(cpu)); | 1107 | set_cpus_allowed(current, cpumask_of_cpu(cpu)); |
1103 | if (smp_processor_id() != cpu) { | 1108 | if (smp_processor_id() != cpu) { |
1104 | printk(KERN_ERR PFX "limiting to CPU %d failed in powernowk8_get\n", cpu); | 1109 | printk(KERN_ERR PFX "limiting to CPU %d failed in powernowk8_get\n", cpu); |
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h index 00ea899c17e1..79a7c5c87edc 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h | |||
@@ -182,10 +182,6 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid); | |||
182 | 182 | ||
183 | static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index); | 183 | static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index); |
184 | 184 | ||
185 | #ifndef for_each_cpu_mask | ||
186 | #define for_each_cpu_mask(i,mask) for (i=0;i<1;i++) | ||
187 | #endif | ||
188 | |||
189 | #ifdef CONFIG_SMP | 185 | #ifdef CONFIG_SMP |
190 | static inline void define_siblings(int cpu, cpumask_t cpu_sharedcore_mask[]) | 186 | static inline void define_siblings(int cpu, cpumask_t cpu_sharedcore_mask[]) |
191 | { | 187 | { |
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index ac38766b2583..037f6bf4543c 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c | |||
@@ -35,12 +35,7 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | #define DEF_FREQUENCY_UP_THRESHOLD (80) | 37 | #define DEF_FREQUENCY_UP_THRESHOLD (80) |
38 | #define MIN_FREQUENCY_UP_THRESHOLD (0) | ||
39 | #define MAX_FREQUENCY_UP_THRESHOLD (100) | ||
40 | |||
41 | #define DEF_FREQUENCY_DOWN_THRESHOLD (20) | 38 | #define DEF_FREQUENCY_DOWN_THRESHOLD (20) |
42 | #define MIN_FREQUENCY_DOWN_THRESHOLD (0) | ||
43 | #define MAX_FREQUENCY_DOWN_THRESHOLD (100) | ||
44 | 39 | ||
45 | /* | 40 | /* |
46 | * The polling frequency of this governor depends on the capability of | 41 | * The polling frequency of this governor depends on the capability of |
@@ -53,10 +48,14 @@ | |||
53 | * All times here are in uS. | 48 | * All times here are in uS. |
54 | */ | 49 | */ |
55 | static unsigned int def_sampling_rate; | 50 | static unsigned int def_sampling_rate; |
56 | #define MIN_SAMPLING_RATE (def_sampling_rate / 2) | 51 | #define MIN_SAMPLING_RATE_RATIO (2) |
52 | /* for correct statistics, we need at least 10 ticks between each measure */ | ||
53 | #define MIN_STAT_SAMPLING_RATE (MIN_SAMPLING_RATE_RATIO * jiffies_to_usecs(10)) | ||
54 | #define MIN_SAMPLING_RATE (def_sampling_rate / MIN_SAMPLING_RATE_RATIO) | ||
57 | #define MAX_SAMPLING_RATE (500 * def_sampling_rate) | 55 | #define MAX_SAMPLING_RATE (500 * def_sampling_rate) |
58 | #define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (100000) | 56 | #define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000) |
59 | #define DEF_SAMPLING_DOWN_FACTOR (5) | 57 | #define DEF_SAMPLING_DOWN_FACTOR (1) |
58 | #define MAX_SAMPLING_DOWN_FACTOR (10) | ||
60 | #define TRANSITION_LATENCY_LIMIT (10 * 1000) | 59 | #define TRANSITION_LATENCY_LIMIT (10 * 1000) |
61 | 60 | ||
62 | static void do_dbs_timer(void *data); | 61 | static void do_dbs_timer(void *data); |
@@ -66,6 +65,8 @@ struct cpu_dbs_info_s { | |||
66 | unsigned int prev_cpu_idle_up; | 65 | unsigned int prev_cpu_idle_up; |
67 | unsigned int prev_cpu_idle_down; | 66 | unsigned int prev_cpu_idle_down; |
68 | unsigned int enable; | 67 | unsigned int enable; |
68 | unsigned int down_skip; | ||
69 | unsigned int requested_freq; | ||
69 | }; | 70 | }; |
70 | static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info); | 71 | static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info); |
71 | 72 | ||
@@ -87,6 +88,8 @@ static struct dbs_tuners dbs_tuners_ins = { | |||
87 | .up_threshold = DEF_FREQUENCY_UP_THRESHOLD, | 88 | .up_threshold = DEF_FREQUENCY_UP_THRESHOLD, |
88 | .down_threshold = DEF_FREQUENCY_DOWN_THRESHOLD, | 89 | .down_threshold = DEF_FREQUENCY_DOWN_THRESHOLD, |
89 | .sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR, | 90 | .sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR, |
91 | .ignore_nice = 0, | ||
92 | .freq_step = 5, | ||
90 | }; | 93 | }; |
91 | 94 | ||
92 | static inline unsigned int get_cpu_idle_time(unsigned int cpu) | 95 | static inline unsigned int get_cpu_idle_time(unsigned int cpu) |
@@ -136,7 +139,7 @@ static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused, | |||
136 | unsigned int input; | 139 | unsigned int input; |
137 | int ret; | 140 | int ret; |
138 | ret = sscanf (buf, "%u", &input); | 141 | ret = sscanf (buf, "%u", &input); |
139 | if (ret != 1 ) | 142 | if (ret != 1 || input > MAX_SAMPLING_DOWN_FACTOR || input < 1) |
140 | return -EINVAL; | 143 | return -EINVAL; |
141 | 144 | ||
142 | mutex_lock(&dbs_mutex); | 145 | mutex_lock(&dbs_mutex); |
@@ -173,8 +176,7 @@ static ssize_t store_up_threshold(struct cpufreq_policy *unused, | |||
173 | ret = sscanf (buf, "%u", &input); | 176 | ret = sscanf (buf, "%u", &input); |
174 | 177 | ||
175 | mutex_lock(&dbs_mutex); | 178 | mutex_lock(&dbs_mutex); |
176 | if (ret != 1 || input > MAX_FREQUENCY_UP_THRESHOLD || | 179 | if (ret != 1 || input > 100 || input < 0 || |
177 | input < MIN_FREQUENCY_UP_THRESHOLD || | ||
178 | input <= dbs_tuners_ins.down_threshold) { | 180 | input <= dbs_tuners_ins.down_threshold) { |
179 | mutex_unlock(&dbs_mutex); | 181 | mutex_unlock(&dbs_mutex); |
180 | return -EINVAL; | 182 | return -EINVAL; |
@@ -194,8 +196,7 @@ static ssize_t store_down_threshold(struct cpufreq_policy *unused, | |||
194 | ret = sscanf (buf, "%u", &input); | 196 | ret = sscanf (buf, "%u", &input); |
195 | 197 | ||
196 | mutex_lock(&dbs_mutex); | 198 | mutex_lock(&dbs_mutex); |
197 | if (ret != 1 || input > MAX_FREQUENCY_DOWN_THRESHOLD || | 199 | if (ret != 1 || input > 100 || input < 0 || |
198 | input < MIN_FREQUENCY_DOWN_THRESHOLD || | ||
199 | input >= dbs_tuners_ins.up_threshold) { | 200 | input >= dbs_tuners_ins.up_threshold) { |
200 | mutex_unlock(&dbs_mutex); | 201 | mutex_unlock(&dbs_mutex); |
201 | return -EINVAL; | 202 | return -EINVAL; |
@@ -297,31 +298,17 @@ static struct attribute_group dbs_attr_group = { | |||
297 | static void dbs_check_cpu(int cpu) | 298 | static void dbs_check_cpu(int cpu) |
298 | { | 299 | { |
299 | unsigned int idle_ticks, up_idle_ticks, down_idle_ticks; | 300 | unsigned int idle_ticks, up_idle_ticks, down_idle_ticks; |
301 | unsigned int tmp_idle_ticks, total_idle_ticks; | ||
300 | unsigned int freq_step; | 302 | unsigned int freq_step; |
301 | unsigned int freq_down_sampling_rate; | 303 | unsigned int freq_down_sampling_rate; |
302 | static int down_skip[NR_CPUS]; | 304 | struct cpu_dbs_info_s *this_dbs_info = &per_cpu(cpu_dbs_info, cpu); |
303 | static int requested_freq[NR_CPUS]; | ||
304 | static unsigned short init_flag = 0; | ||
305 | struct cpu_dbs_info_s *this_dbs_info; | ||
306 | struct cpu_dbs_info_s *dbs_info; | ||
307 | |||
308 | struct cpufreq_policy *policy; | 305 | struct cpufreq_policy *policy; |
309 | unsigned int j; | ||
310 | 306 | ||
311 | this_dbs_info = &per_cpu(cpu_dbs_info, cpu); | ||
312 | if (!this_dbs_info->enable) | 307 | if (!this_dbs_info->enable) |
313 | return; | 308 | return; |
314 | 309 | ||
315 | policy = this_dbs_info->cur_policy; | 310 | policy = this_dbs_info->cur_policy; |
316 | 311 | ||
317 | if ( init_flag == 0 ) { | ||
318 | for_each_online_cpu(j) { | ||
319 | dbs_info = &per_cpu(cpu_dbs_info, j); | ||
320 | requested_freq[j] = dbs_info->cur_policy->cur; | ||
321 | } | ||
322 | init_flag = 1; | ||
323 | } | ||
324 | |||
325 | /* | 312 | /* |
326 | * The default safe range is 20% to 80% | 313 | * The default safe range is 20% to 80% |
327 | * Every sampling_rate, we check | 314 | * Every sampling_rate, we check |
@@ -337,39 +324,29 @@ static void dbs_check_cpu(int cpu) | |||
337 | */ | 324 | */ |
338 | 325 | ||
339 | /* Check for frequency increase */ | 326 | /* Check for frequency increase */ |
340 | |||
341 | idle_ticks = UINT_MAX; | 327 | idle_ticks = UINT_MAX; |
342 | for_each_cpu_mask(j, policy->cpus) { | ||
343 | unsigned int tmp_idle_ticks, total_idle_ticks; | ||
344 | struct cpu_dbs_info_s *j_dbs_info; | ||
345 | 328 | ||
346 | j_dbs_info = &per_cpu(cpu_dbs_info, j); | 329 | /* Check for frequency increase */ |
347 | /* Check for frequency increase */ | 330 | total_idle_ticks = get_cpu_idle_time(cpu); |
348 | total_idle_ticks = get_cpu_idle_time(j); | 331 | tmp_idle_ticks = total_idle_ticks - |
349 | tmp_idle_ticks = total_idle_ticks - | 332 | this_dbs_info->prev_cpu_idle_up; |
350 | j_dbs_info->prev_cpu_idle_up; | 333 | this_dbs_info->prev_cpu_idle_up = total_idle_ticks; |
351 | j_dbs_info->prev_cpu_idle_up = total_idle_ticks; | 334 | |
352 | 335 | if (tmp_idle_ticks < idle_ticks) | |
353 | if (tmp_idle_ticks < idle_ticks) | 336 | idle_ticks = tmp_idle_ticks; |
354 | idle_ticks = tmp_idle_ticks; | ||
355 | } | ||
356 | 337 | ||
357 | /* Scale idle ticks by 100 and compare with up and down ticks */ | 338 | /* Scale idle ticks by 100 and compare with up and down ticks */ |
358 | idle_ticks *= 100; | 339 | idle_ticks *= 100; |
359 | up_idle_ticks = (100 - dbs_tuners_ins.up_threshold) * | 340 | up_idle_ticks = (100 - dbs_tuners_ins.up_threshold) * |
360 | usecs_to_jiffies(dbs_tuners_ins.sampling_rate); | 341 | usecs_to_jiffies(dbs_tuners_ins.sampling_rate); |
361 | 342 | ||
362 | if (idle_ticks < up_idle_ticks) { | 343 | if (idle_ticks < up_idle_ticks) { |
363 | down_skip[cpu] = 0; | 344 | this_dbs_info->down_skip = 0; |
364 | for_each_cpu_mask(j, policy->cpus) { | 345 | this_dbs_info->prev_cpu_idle_down = |
365 | struct cpu_dbs_info_s *j_dbs_info; | 346 | this_dbs_info->prev_cpu_idle_up; |
366 | 347 | ||
367 | j_dbs_info = &per_cpu(cpu_dbs_info, j); | ||
368 | j_dbs_info->prev_cpu_idle_down = | ||
369 | j_dbs_info->prev_cpu_idle_up; | ||
370 | } | ||
371 | /* if we are already at full speed then break out early */ | 348 | /* if we are already at full speed then break out early */ |
372 | if (requested_freq[cpu] == policy->max) | 349 | if (this_dbs_info->requested_freq == policy->max) |
373 | return; | 350 | return; |
374 | 351 | ||
375 | freq_step = (dbs_tuners_ins.freq_step * policy->max) / 100; | 352 | freq_step = (dbs_tuners_ins.freq_step * policy->max) / 100; |
@@ -378,49 +355,45 @@ static void dbs_check_cpu(int cpu) | |||
378 | if (unlikely(freq_step == 0)) | 355 | if (unlikely(freq_step == 0)) |
379 | freq_step = 5; | 356 | freq_step = 5; |
380 | 357 | ||
381 | requested_freq[cpu] += freq_step; | 358 | this_dbs_info->requested_freq += freq_step; |
382 | if (requested_freq[cpu] > policy->max) | 359 | if (this_dbs_info->requested_freq > policy->max) |
383 | requested_freq[cpu] = policy->max; | 360 | this_dbs_info->requested_freq = policy->max; |
384 | 361 | ||
385 | __cpufreq_driver_target(policy, requested_freq[cpu], | 362 | __cpufreq_driver_target(policy, this_dbs_info->requested_freq, |
386 | CPUFREQ_RELATION_H); | 363 | CPUFREQ_RELATION_H); |
387 | return; | 364 | return; |
388 | } | 365 | } |
389 | 366 | ||
390 | /* Check for frequency decrease */ | 367 | /* Check for frequency decrease */ |
391 | down_skip[cpu]++; | 368 | this_dbs_info->down_skip++; |
392 | if (down_skip[cpu] < dbs_tuners_ins.sampling_down_factor) | 369 | if (this_dbs_info->down_skip < dbs_tuners_ins.sampling_down_factor) |
393 | return; | 370 | return; |
394 | 371 | ||
395 | idle_ticks = UINT_MAX; | 372 | /* Check for frequency decrease */ |
396 | for_each_cpu_mask(j, policy->cpus) { | 373 | total_idle_ticks = this_dbs_info->prev_cpu_idle_up; |
397 | unsigned int tmp_idle_ticks, total_idle_ticks; | 374 | tmp_idle_ticks = total_idle_ticks - |
398 | struct cpu_dbs_info_s *j_dbs_info; | 375 | this_dbs_info->prev_cpu_idle_down; |
376 | this_dbs_info->prev_cpu_idle_down = total_idle_ticks; | ||
399 | 377 | ||
400 | j_dbs_info = &per_cpu(cpu_dbs_info, j); | 378 | if (tmp_idle_ticks < idle_ticks) |
401 | total_idle_ticks = j_dbs_info->prev_cpu_idle_up; | 379 | idle_ticks = tmp_idle_ticks; |
402 | tmp_idle_ticks = total_idle_ticks - | ||
403 | j_dbs_info->prev_cpu_idle_down; | ||
404 | j_dbs_info->prev_cpu_idle_down = total_idle_ticks; | ||
405 | |||
406 | if (tmp_idle_ticks < idle_ticks) | ||
407 | idle_ticks = tmp_idle_ticks; | ||
408 | } | ||
409 | 380 | ||
410 | /* Scale idle ticks by 100 and compare with up and down ticks */ | 381 | /* Scale idle ticks by 100 and compare with up and down ticks */ |
411 | idle_ticks *= 100; | 382 | idle_ticks *= 100; |
412 | down_skip[cpu] = 0; | 383 | this_dbs_info->down_skip = 0; |
413 | 384 | ||
414 | freq_down_sampling_rate = dbs_tuners_ins.sampling_rate * | 385 | freq_down_sampling_rate = dbs_tuners_ins.sampling_rate * |
415 | dbs_tuners_ins.sampling_down_factor; | 386 | dbs_tuners_ins.sampling_down_factor; |
416 | down_idle_ticks = (100 - dbs_tuners_ins.down_threshold) * | 387 | down_idle_ticks = (100 - dbs_tuners_ins.down_threshold) * |
417 | usecs_to_jiffies(freq_down_sampling_rate); | 388 | usecs_to_jiffies(freq_down_sampling_rate); |
418 | 389 | ||
419 | if (idle_ticks > down_idle_ticks) { | 390 | if (idle_ticks > down_idle_ticks) { |
420 | /* if we are already at the lowest speed then break out early | 391 | /* |
392 | * if we are already at the lowest speed then break out early | ||
421 | * or if we 'cannot' reduce the speed as the user might want | 393 | * or if we 'cannot' reduce the speed as the user might want |
422 | * freq_step to be zero */ | 394 | * freq_step to be zero |
423 | if (requested_freq[cpu] == policy->min | 395 | */ |
396 | if (this_dbs_info->requested_freq == policy->min | ||
424 | || dbs_tuners_ins.freq_step == 0) | 397 | || dbs_tuners_ins.freq_step == 0) |
425 | return; | 398 | return; |
426 | 399 | ||
@@ -430,13 +403,12 @@ static void dbs_check_cpu(int cpu) | |||
430 | if (unlikely(freq_step == 0)) | 403 | if (unlikely(freq_step == 0)) |
431 | freq_step = 5; | 404 | freq_step = 5; |
432 | 405 | ||
433 | requested_freq[cpu] -= freq_step; | 406 | this_dbs_info->requested_freq -= freq_step; |
434 | if (requested_freq[cpu] < policy->min) | 407 | if (this_dbs_info->requested_freq < policy->min) |
435 | requested_freq[cpu] = policy->min; | 408 | this_dbs_info->requested_freq = policy->min; |
436 | 409 | ||
437 | __cpufreq_driver_target(policy, | 410 | __cpufreq_driver_target(policy, this_dbs_info->requested_freq, |
438 | requested_freq[cpu], | 411 | CPUFREQ_RELATION_H); |
439 | CPUFREQ_RELATION_H); | ||
440 | return; | 412 | return; |
441 | } | 413 | } |
442 | } | 414 | } |
@@ -493,11 +465,13 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
493 | j_dbs_info = &per_cpu(cpu_dbs_info, j); | 465 | j_dbs_info = &per_cpu(cpu_dbs_info, j); |
494 | j_dbs_info->cur_policy = policy; | 466 | j_dbs_info->cur_policy = policy; |
495 | 467 | ||
496 | j_dbs_info->prev_cpu_idle_up = get_cpu_idle_time(j); | 468 | j_dbs_info->prev_cpu_idle_up = get_cpu_idle_time(cpu); |
497 | j_dbs_info->prev_cpu_idle_down | 469 | j_dbs_info->prev_cpu_idle_down |
498 | = j_dbs_info->prev_cpu_idle_up; | 470 | = j_dbs_info->prev_cpu_idle_up; |
499 | } | 471 | } |
500 | this_dbs_info->enable = 1; | 472 | this_dbs_info->enable = 1; |
473 | this_dbs_info->down_skip = 0; | ||
474 | this_dbs_info->requested_freq = policy->cur; | ||
501 | sysfs_create_group(&policy->kobj, &dbs_attr_group); | 475 | sysfs_create_group(&policy->kobj, &dbs_attr_group); |
502 | dbs_enable++; | 476 | dbs_enable++; |
503 | /* | 477 | /* |
@@ -507,16 +481,17 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
507 | if (dbs_enable == 1) { | 481 | if (dbs_enable == 1) { |
508 | unsigned int latency; | 482 | unsigned int latency; |
509 | /* policy latency is in nS. Convert it to uS first */ | 483 | /* policy latency is in nS. Convert it to uS first */ |
484 | latency = policy->cpuinfo.transition_latency / 1000; | ||
485 | if (latency == 0) | ||
486 | latency = 1; | ||
510 | 487 | ||
511 | latency = policy->cpuinfo.transition_latency; | 488 | def_sampling_rate = 10 * latency * |
512 | if (latency < 1000) | ||
513 | latency = 1000; | ||
514 | |||
515 | def_sampling_rate = (latency / 1000) * | ||
516 | DEF_SAMPLING_RATE_LATENCY_MULTIPLIER; | 489 | DEF_SAMPLING_RATE_LATENCY_MULTIPLIER; |
490 | |||
491 | if (def_sampling_rate < MIN_STAT_SAMPLING_RATE) | ||
492 | def_sampling_rate = MIN_STAT_SAMPLING_RATE; | ||
493 | |||
517 | dbs_tuners_ins.sampling_rate = def_sampling_rate; | 494 | dbs_tuners_ins.sampling_rate = def_sampling_rate; |
518 | dbs_tuners_ins.ignore_nice = 0; | ||
519 | dbs_tuners_ins.freq_step = 5; | ||
520 | 495 | ||
521 | dbs_timer_init(); | 496 | dbs_timer_init(); |
522 | } | 497 | } |
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index 69aa1db8336c..956d121cb161 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
@@ -84,6 +84,7 @@ struct dbs_tuners { | |||
84 | static struct dbs_tuners dbs_tuners_ins = { | 84 | static struct dbs_tuners dbs_tuners_ins = { |
85 | .up_threshold = DEF_FREQUENCY_UP_THRESHOLD, | 85 | .up_threshold = DEF_FREQUENCY_UP_THRESHOLD, |
86 | .sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR, | 86 | .sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR, |
87 | .ignore_nice = 0, | ||
87 | }; | 88 | }; |
88 | 89 | ||
89 | static inline unsigned int get_cpu_idle_time(unsigned int cpu) | 90 | static inline unsigned int get_cpu_idle_time(unsigned int cpu) |
@@ -350,6 +351,9 @@ static void dbs_check_cpu(int cpu) | |||
350 | freq_next = (freq_next * policy->cur) / | 351 | freq_next = (freq_next * policy->cur) / |
351 | (dbs_tuners_ins.up_threshold - 10); | 352 | (dbs_tuners_ins.up_threshold - 10); |
352 | 353 | ||
354 | if (freq_next < policy->min) | ||
355 | freq_next = policy->min; | ||
356 | |||
353 | if (freq_next <= ((policy->cur * 95) / 100)) | 357 | if (freq_next <= ((policy->cur * 95) / 100)) |
354 | __cpufreq_driver_target(policy, freq_next, CPUFREQ_RELATION_L); | 358 | __cpufreq_driver_target(policy, freq_next, CPUFREQ_RELATION_L); |
355 | } | 359 | } |
@@ -395,8 +399,11 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
395 | return -EINVAL; | 399 | return -EINVAL; |
396 | 400 | ||
397 | if (policy->cpuinfo.transition_latency > | 401 | if (policy->cpuinfo.transition_latency > |
398 | (TRANSITION_LATENCY_LIMIT * 1000)) | 402 | (TRANSITION_LATENCY_LIMIT * 1000)) { |
403 | printk(KERN_WARNING "ondemand governor failed to load " | ||
404 | "due to too long transition latency\n"); | ||
399 | return -EINVAL; | 405 | return -EINVAL; |
406 | } | ||
400 | if (this_dbs_info->enable) /* Already enabled */ | 407 | if (this_dbs_info->enable) /* Already enabled */ |
401 | break; | 408 | break; |
402 | 409 | ||
@@ -431,8 +438,6 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
431 | def_sampling_rate = MIN_STAT_SAMPLING_RATE; | 438 | def_sampling_rate = MIN_STAT_SAMPLING_RATE; |
432 | 439 | ||
433 | dbs_tuners_ins.sampling_rate = def_sampling_rate; | 440 | dbs_tuners_ins.sampling_rate = def_sampling_rate; |
434 | dbs_tuners_ins.ignore_nice = 0; | ||
435 | |||
436 | dbs_timer_init(); | 441 | dbs_timer_init(); |
437 | } | 442 | } |
438 | 443 | ||