diff options
author | Dave Jones <davej@redhat.com> | 2006-12-12 17:41:41 -0500 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2006-12-12 17:41:41 -0500 |
commit | c4366889dda8110247be59ca41fddb82951a8c26 (patch) | |
tree | 705c1a996bed8fd48ce94ff33ec9fd00f9b94875 /drivers/cpufreq/cpufreq_ondemand.c | |
parent | db2fb9db5735cc532fd4fc55e94b9a3c3750378e (diff) | |
parent | e1036502e5263851259d147771226161e5ccc85a (diff) |
Merge ../linus
Conflicts:
drivers/cpufreq/cpufreq.c
Diffstat (limited to 'drivers/cpufreq/cpufreq_ondemand.c')
-rw-r--r-- | drivers/cpufreq/cpufreq_ondemand.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index 048ec8b1f406..f697449327c6 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
@@ -49,13 +49,17 @@ static unsigned int def_sampling_rate; | |||
49 | #define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000) | 49 | #define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000) |
50 | #define TRANSITION_LATENCY_LIMIT (10 * 1000) | 50 | #define TRANSITION_LATENCY_LIMIT (10 * 1000) |
51 | 51 | ||
52 | static void do_dbs_timer(void *data); | 52 | static void do_dbs_timer(struct work_struct *work); |
53 | |||
54 | /* Sampling types */ | ||
55 | enum dbs_sample {DBS_NORMAL_SAMPLE, DBS_SUB_SAMPLE}; | ||
53 | 56 | ||
54 | struct cpu_dbs_info_s { | 57 | struct cpu_dbs_info_s { |
55 | cputime64_t prev_cpu_idle; | 58 | cputime64_t prev_cpu_idle; |
56 | cputime64_t prev_cpu_wall; | 59 | cputime64_t prev_cpu_wall; |
57 | struct cpufreq_policy *cur_policy; | 60 | struct cpufreq_policy *cur_policy; |
58 | struct work_struct work; | 61 | struct delayed_work work; |
62 | enum dbs_sample sample_type; | ||
59 | unsigned int enable; | 63 | unsigned int enable; |
60 | struct cpufreq_frequency_table *freq_table; | 64 | struct cpufreq_frequency_table *freq_table; |
61 | unsigned int freq_lo; | 65 | unsigned int freq_lo; |
@@ -417,30 +421,31 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) | |||
417 | } | 421 | } |
418 | } | 422 | } |
419 | 423 | ||
420 | /* Sampling types */ | 424 | static void do_dbs_timer(struct work_struct *work) |
421 | enum {DBS_NORMAL_SAMPLE, DBS_SUB_SAMPLE}; | ||
422 | |||
423 | static void do_dbs_timer(void *data) | ||
424 | { | 425 | { |
425 | unsigned int cpu = smp_processor_id(); | 426 | unsigned int cpu = smp_processor_id(); |
426 | struct cpu_dbs_info_s *dbs_info = &per_cpu(cpu_dbs_info, cpu); | 427 | struct cpu_dbs_info_s *dbs_info = &per_cpu(cpu_dbs_info, cpu); |
428 | enum dbs_sample sample_type = dbs_info->sample_type; | ||
427 | /* We want all CPUs to do sampling nearly on same jiffy */ | 429 | /* We want all CPUs to do sampling nearly on same jiffy */ |
428 | int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate); | 430 | int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate); |
431 | |||
432 | /* Permit rescheduling of this work item */ | ||
433 | work_release(work); | ||
434 | |||
429 | delay -= jiffies % delay; | 435 | delay -= jiffies % delay; |
430 | 436 | ||
431 | if (!dbs_info->enable) | 437 | if (!dbs_info->enable) |
432 | return; | 438 | return; |
433 | /* Common NORMAL_SAMPLE setup */ | 439 | /* Common NORMAL_SAMPLE setup */ |
434 | INIT_WORK(&dbs_info->work, do_dbs_timer, (void *)DBS_NORMAL_SAMPLE); | 440 | dbs_info->sample_type = DBS_NORMAL_SAMPLE; |
435 | if (!dbs_tuners_ins.powersave_bias || | 441 | if (!dbs_tuners_ins.powersave_bias || |
436 | (unsigned long) data == DBS_NORMAL_SAMPLE) { | 442 | sample_type == DBS_NORMAL_SAMPLE) { |
437 | lock_cpu_hotplug(); | 443 | lock_cpu_hotplug(); |
438 | dbs_check_cpu(dbs_info); | 444 | dbs_check_cpu(dbs_info); |
439 | unlock_cpu_hotplug(); | 445 | unlock_cpu_hotplug(); |
440 | if (dbs_info->freq_lo) { | 446 | if (dbs_info->freq_lo) { |
441 | /* Setup timer for SUB_SAMPLE */ | 447 | /* Setup timer for SUB_SAMPLE */ |
442 | INIT_WORK(&dbs_info->work, do_dbs_timer, | 448 | dbs_info->sample_type = DBS_SUB_SAMPLE; |
443 | (void *)DBS_SUB_SAMPLE); | ||
444 | delay = dbs_info->freq_hi_jiffies; | 449 | delay = dbs_info->freq_hi_jiffies; |
445 | } | 450 | } |
446 | } else { | 451 | } else { |
@@ -459,7 +464,8 @@ static inline void dbs_timer_init(unsigned int cpu) | |||
459 | delay -= jiffies % delay; | 464 | delay -= jiffies % delay; |
460 | 465 | ||
461 | ondemand_powersave_bias_init(); | 466 | ondemand_powersave_bias_init(); |
462 | INIT_WORK(&dbs_info->work, do_dbs_timer, NULL); | 467 | INIT_DELAYED_WORK_NAR(&dbs_info->work, do_dbs_timer); |
468 | dbs_info->sample_type = DBS_NORMAL_SAMPLE; | ||
463 | queue_delayed_work_on(cpu, kondemand_wq, &dbs_info->work, delay); | 469 | queue_delayed_work_on(cpu, kondemand_wq, &dbs_info->work, delay); |
464 | } | 470 | } |
465 | 471 | ||