2 * drivers/cpufreq/cpufreq_ondemand.c
4 * Copyright (C) 2001 Russell King
5 * (C) 2003 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>.
6 * Jun Nakajima <jun.nakajima@intel.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <linux/kernel.h>
14 #include <linux/module.h>
15 #include <linux/init.h>
16 #include <linux/cpufreq.h>
17 #include <linux/cpu.h>
18 #include <linux/jiffies.h>
19 #include <linux/kernel_stat.h>
20 #include <linux/mutex.h>
21 #include <linux/hrtimer.h>
22 #include <linux/tick.h>
23 #include <linux/ktime.h>
24 #include <linux/sched.h>
27 * dbs is used in this file as a shortform for demandbased switching
28 * It helps to keep variable names smaller, simpler
31 #define DEF_FREQUENCY_DOWN_DIFFERENTIAL (10)
32 #define DEF_FREQUENCY_UP_THRESHOLD (80)
33 #ifdef CONFIG_ARCH_RK29
34 #define MICRO_FREQUENCY_DOWN_DIFFERENTIAL (10)
35 #define MICRO_FREQUENCY_UP_THRESHOLD (80)
37 #define MICRO_FREQUENCY_DOWN_DIFFERENTIAL (3)
38 #define MICRO_FREQUENCY_UP_THRESHOLD (95)
40 #define MICRO_FREQUENCY_MIN_SAMPLE_RATE (10000)
41 #define MIN_FREQUENCY_UP_THRESHOLD (11)
42 #define MAX_FREQUENCY_UP_THRESHOLD (100)
45 * The polling frequency of this governor depends on the capability of
46 * the processor. Default polling frequency is 1000 times the transition
47 * latency of the processor. The governor will work on any processor with
48 * transition latency <= 10mS, using appropriate sampling
50 * For CPUs with transition latency > 10mS (mostly drivers with CPUFREQ_ETERNAL)
51 * this governor will not work.
52 * All times here are in uS.
54 #define MIN_SAMPLING_RATE_RATIO (2)
56 static unsigned int min_sampling_rate;
58 #define LATENCY_MULTIPLIER (1000)
59 #define MIN_LATENCY_MULTIPLIER (100)
60 #define TRANSITION_LATENCY_LIMIT (10 * 1000 * 1000)
62 static void do_dbs_timer(struct work_struct *work);
63 static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
66 #ifndef CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND
69 struct cpufreq_governor cpufreq_gov_ondemand = {
71 .governor = cpufreq_governor_dbs,
72 .max_transition_latency = TRANSITION_LATENCY_LIMIT,
77 enum {DBS_NORMAL_SAMPLE, DBS_SUB_SAMPLE};
79 struct cpu_dbs_info_s {
80 cputime64_t prev_cpu_idle;
81 cputime64_t prev_cpu_wall;
82 cputime64_t prev_cpu_nice;
83 struct cpufreq_policy *cur_policy;
84 struct delayed_work work;
85 struct cpufreq_frequency_table *freq_table;
87 unsigned int freq_lo_jiffies;
88 unsigned int freq_hi_jiffies;
90 unsigned int sample_type:1;
92 * percpu mutex that serializes governor limit change with
93 * do_dbs_timer invocation. We do not want do_dbs_timer to run
94 * when user is changing the governor or limits.
96 struct mutex timer_mutex;
98 static DEFINE_PER_CPU(struct cpu_dbs_info_s, od_cpu_dbs_info);
100 static unsigned int dbs_enable; /* number of CPUs using this policy */
103 * dbs_mutex protects data in dbs_tuners_ins from concurrent changes on
104 * different CPUs. It protects dbs_enable in governor start/stop.
106 static DEFINE_MUTEX(dbs_mutex);
108 static struct workqueue_struct *kondemand_wq;
110 static struct dbs_tuners {
111 unsigned int sampling_rate;
112 unsigned int up_threshold;
113 unsigned int down_differential;
114 unsigned int ignore_nice;
115 unsigned int powersave_bias;
117 .up_threshold = DEF_FREQUENCY_UP_THRESHOLD,
118 .down_differential = DEF_FREQUENCY_DOWN_DIFFERENTIAL,
119 #ifdef CONFIG_ARCH_RK29
127 static inline cputime64_t get_cpu_idle_time_jiffy(unsigned int cpu,
130 cputime64_t idle_time;
131 cputime64_t cur_wall_time;
132 cputime64_t busy_time;
134 cur_wall_time = jiffies64_to_cputime64(get_jiffies_64());
135 busy_time = cputime64_add(kstat_cpu(cpu).cpustat.user,
136 kstat_cpu(cpu).cpustat.system);
138 busy_time = cputime64_add(busy_time, kstat_cpu(cpu).cpustat.irq);
139 busy_time = cputime64_add(busy_time, kstat_cpu(cpu).cpustat.softirq);
140 busy_time = cputime64_add(busy_time, kstat_cpu(cpu).cpustat.steal);
141 busy_time = cputime64_add(busy_time, kstat_cpu(cpu).cpustat.nice);
143 idle_time = cputime64_sub(cur_wall_time, busy_time);
145 *wall = (cputime64_t)jiffies_to_usecs(cur_wall_time);
147 return (cputime64_t)jiffies_to_usecs(idle_time);
150 static inline cputime64_t get_cpu_idle_time(unsigned int cpu, cputime64_t *wall)
152 u64 idle_time = get_cpu_idle_time_us(cpu, wall);
154 if (idle_time == -1ULL)
155 return get_cpu_idle_time_jiffy(cpu, wall);
161 * Find right freq to be set now with powersave_bias on.
162 * Returns the freq_hi to be used right now and will set freq_hi_jiffies,
163 * freq_lo, and freq_lo_jiffies in percpu area for averaging freqs.
165 static unsigned int powersave_bias_target(struct cpufreq_policy *policy,
166 unsigned int freq_next,
167 unsigned int relation)
169 unsigned int freq_req, freq_reduc, freq_avg;
170 unsigned int freq_hi, freq_lo;
171 unsigned int index = 0;
172 unsigned int jiffies_total, jiffies_hi, jiffies_lo;
173 struct cpu_dbs_info_s *dbs_info = &per_cpu(od_cpu_dbs_info,
176 if (!dbs_info->freq_table) {
177 dbs_info->freq_lo = 0;
178 dbs_info->freq_lo_jiffies = 0;
182 cpufreq_frequency_table_target(policy, dbs_info->freq_table, freq_next,
184 freq_req = dbs_info->freq_table[index].frequency;
185 freq_reduc = freq_req * dbs_tuners_ins.powersave_bias / 1000;
186 freq_avg = freq_req - freq_reduc;
188 /* Find freq bounds for freq_avg in freq_table */
190 cpufreq_frequency_table_target(policy, dbs_info->freq_table, freq_avg,
191 CPUFREQ_RELATION_H, &index);
192 freq_lo = dbs_info->freq_table[index].frequency;
194 cpufreq_frequency_table_target(policy, dbs_info->freq_table, freq_avg,
195 CPUFREQ_RELATION_L, &index);
196 freq_hi = dbs_info->freq_table[index].frequency;
198 /* Find out how long we have to be in hi and lo freqs */
199 if (freq_hi == freq_lo) {
200 dbs_info->freq_lo = 0;
201 dbs_info->freq_lo_jiffies = 0;
204 jiffies_total = usecs_to_jiffies(dbs_tuners_ins.sampling_rate);
205 jiffies_hi = (freq_avg - freq_lo) * jiffies_total;
206 jiffies_hi += ((freq_hi - freq_lo) / 2);
207 jiffies_hi /= (freq_hi - freq_lo);
208 jiffies_lo = jiffies_total - jiffies_hi;
209 dbs_info->freq_lo = freq_lo;
210 dbs_info->freq_lo_jiffies = jiffies_lo;
211 dbs_info->freq_hi_jiffies = jiffies_hi;
215 static void ondemand_powersave_bias_init_cpu(int cpu)
217 struct cpu_dbs_info_s *dbs_info = &per_cpu(od_cpu_dbs_info, cpu);
218 dbs_info->freq_table = cpufreq_frequency_get_table(cpu);
219 dbs_info->freq_lo = 0;
222 static void ondemand_powersave_bias_init(void)
225 for_each_online_cpu(i) {
226 ondemand_powersave_bias_init_cpu(i);
230 /************************** sysfs interface ************************/
232 static ssize_t show_sampling_rate_max(struct kobject *kobj,
233 struct attribute *attr, char *buf)
235 printk_once(KERN_INFO "CPUFREQ: ondemand sampling_rate_max "
236 "sysfs file is deprecated - used by: %s\n", current->comm);
237 return sprintf(buf, "%u\n", -1U);
240 static ssize_t show_sampling_rate_min(struct kobject *kobj,
241 struct attribute *attr, char *buf)
243 return sprintf(buf, "%u\n", min_sampling_rate);
246 #define define_one_ro(_name) \
247 static struct global_attr _name = \
248 __ATTR(_name, 0444, show_##_name, NULL)
250 define_one_ro(sampling_rate_max);
251 define_one_ro(sampling_rate_min);
253 /* cpufreq_ondemand Governor Tunables */
254 #define show_one(file_name, object) \
255 static ssize_t show_##file_name \
256 (struct kobject *kobj, struct attribute *attr, char *buf) \
258 return sprintf(buf, "%u\n", dbs_tuners_ins.object); \
260 show_one(sampling_rate, sampling_rate);
261 show_one(up_threshold, up_threshold);
262 show_one(ignore_nice_load, ignore_nice);
263 show_one(powersave_bias, powersave_bias);
265 /*** delete after deprecation time ***/
267 #define DEPRECATION_MSG(file_name) \
268 printk_once(KERN_INFO "CPUFREQ: Per core ondemand sysfs " \
269 "interface is deprecated - " #file_name "\n");
271 #define show_one_old(file_name) \
272 static ssize_t show_##file_name##_old \
273 (struct cpufreq_policy *unused, char *buf) \
275 printk_once(KERN_INFO "CPUFREQ: Per core ondemand sysfs " \
276 "interface is deprecated - " #file_name "\n"); \
277 return show_##file_name(NULL, NULL, buf); \
279 show_one_old(sampling_rate);
280 show_one_old(up_threshold);
281 show_one_old(ignore_nice_load);
282 show_one_old(powersave_bias);
283 show_one_old(sampling_rate_min);
284 show_one_old(sampling_rate_max);
286 #define define_one_ro_old(object, _name) \
287 static struct freq_attr object = \
288 __ATTR(_name, 0444, show_##_name##_old, NULL)
290 define_one_ro_old(sampling_rate_min_old, sampling_rate_min);
291 define_one_ro_old(sampling_rate_max_old, sampling_rate_max);
293 /*** delete after deprecation time ***/
295 static ssize_t store_sampling_rate(struct kobject *a, struct attribute *b,
296 const char *buf, size_t count)
300 ret = sscanf(buf, "%u", &input);
304 mutex_lock(&dbs_mutex);
305 dbs_tuners_ins.sampling_rate = max(input, min_sampling_rate);
306 mutex_unlock(&dbs_mutex);
311 static ssize_t store_up_threshold(struct kobject *a, struct attribute *b,
312 const char *buf, size_t count)
316 ret = sscanf(buf, "%u", &input);
318 if (ret != 1 || input > MAX_FREQUENCY_UP_THRESHOLD ||
319 input < MIN_FREQUENCY_UP_THRESHOLD) {
323 mutex_lock(&dbs_mutex);
324 dbs_tuners_ins.up_threshold = input;
325 mutex_unlock(&dbs_mutex);
330 static ssize_t store_ignore_nice_load(struct kobject *a, struct attribute *b,
331 const char *buf, size_t count)
338 ret = sscanf(buf, "%u", &input);
345 mutex_lock(&dbs_mutex);
346 if (input == dbs_tuners_ins.ignore_nice) { /* nothing to do */
347 mutex_unlock(&dbs_mutex);
350 dbs_tuners_ins.ignore_nice = input;
352 /* we need to re-evaluate prev_cpu_idle */
353 for_each_online_cpu(j) {
354 struct cpu_dbs_info_s *dbs_info;
355 dbs_info = &per_cpu(od_cpu_dbs_info, j);
356 dbs_info->prev_cpu_idle = get_cpu_idle_time(j,
357 &dbs_info->prev_cpu_wall);
358 if (dbs_tuners_ins.ignore_nice)
359 dbs_info->prev_cpu_nice = kstat_cpu(j).cpustat.nice;
362 mutex_unlock(&dbs_mutex);
367 static ssize_t store_powersave_bias(struct kobject *a, struct attribute *b,
368 const char *buf, size_t count)
372 ret = sscanf(buf, "%u", &input);
380 mutex_lock(&dbs_mutex);
381 dbs_tuners_ins.powersave_bias = input;
382 ondemand_powersave_bias_init();
383 mutex_unlock(&dbs_mutex);
388 #define define_one_rw(_name) \
389 static struct global_attr _name = \
390 __ATTR(_name, 0644, show_##_name, store_##_name)
392 define_one_rw(sampling_rate);
393 define_one_rw(up_threshold);
394 define_one_rw(ignore_nice_load);
395 define_one_rw(powersave_bias);
397 static struct attribute *dbs_attributes[] = {
398 &sampling_rate_max.attr,
399 &sampling_rate_min.attr,
402 &ignore_nice_load.attr,
403 &powersave_bias.attr,
407 static struct attribute_group dbs_attr_group = {
408 .attrs = dbs_attributes,
412 /*** delete after deprecation time ***/
414 #define write_one_old(file_name) \
415 static ssize_t store_##file_name##_old \
416 (struct cpufreq_policy *unused, const char *buf, size_t count) \
418 printk_once(KERN_INFO "CPUFREQ: Per core ondemand sysfs " \
419 "interface is deprecated - " #file_name "\n"); \
420 return store_##file_name(NULL, NULL, buf, count); \
422 write_one_old(sampling_rate);
423 write_one_old(up_threshold);
424 write_one_old(ignore_nice_load);
425 write_one_old(powersave_bias);
427 #define define_one_rw_old(object, _name) \
428 static struct freq_attr object = \
429 __ATTR(_name, 0644, show_##_name##_old, store_##_name##_old)
431 define_one_rw_old(sampling_rate_old, sampling_rate);
432 define_one_rw_old(up_threshold_old, up_threshold);
433 define_one_rw_old(ignore_nice_load_old, ignore_nice_load);
434 define_one_rw_old(powersave_bias_old, powersave_bias);
436 static struct attribute *dbs_attributes_old[] = {
437 &sampling_rate_max_old.attr,
438 &sampling_rate_min_old.attr,
439 &sampling_rate_old.attr,
440 &up_threshold_old.attr,
441 &ignore_nice_load_old.attr,
442 &powersave_bias_old.attr,
446 static struct attribute_group dbs_attr_group_old = {
447 .attrs = dbs_attributes_old,
451 /*** delete after deprecation time ***/
453 /************************** sysfs end ************************/
455 static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
457 unsigned int max_load_freq;
459 struct cpufreq_policy *policy;
462 this_dbs_info->freq_lo = 0;
463 policy = this_dbs_info->cur_policy;
466 * Every sampling_rate, we check, if current idle time is less
467 * than 20% (default), then we try to increase frequency
468 * Every sampling_rate, we look for a the lowest
469 * frequency which can sustain the load while keeping idle time over
470 * 30%. If such a frequency exist, we try to decrease to this frequency.
472 * Any frequency increase takes it to the maximum frequency.
473 * Frequency reduction happens at minimum steps of
474 * 5% (default) of current frequency
477 /* Get Absolute Load - in terms of freq */
480 for_each_cpu(j, policy->cpus) {
481 struct cpu_dbs_info_s *j_dbs_info;
482 cputime64_t cur_wall_time, cur_idle_time;
483 unsigned int idle_time, wall_time;
484 unsigned int load, load_freq;
487 j_dbs_info = &per_cpu(od_cpu_dbs_info, j);
489 cur_idle_time = get_cpu_idle_time(j, &cur_wall_time);
491 wall_time = (unsigned int) cputime64_sub(cur_wall_time,
492 j_dbs_info->prev_cpu_wall);
493 j_dbs_info->prev_cpu_wall = cur_wall_time;
495 idle_time = (unsigned int) cputime64_sub(cur_idle_time,
496 j_dbs_info->prev_cpu_idle);
497 j_dbs_info->prev_cpu_idle = cur_idle_time;
499 if (dbs_tuners_ins.ignore_nice) {
500 cputime64_t cur_nice;
501 unsigned long cur_nice_jiffies;
503 cur_nice = cputime64_sub(kstat_cpu(j).cpustat.nice,
504 j_dbs_info->prev_cpu_nice);
506 * Assumption: nice time between sampling periods will
507 * be less than 2^32 jiffies for 32 bit sys
509 cur_nice_jiffies = (unsigned long)
510 cputime64_to_jiffies64(cur_nice);
512 j_dbs_info->prev_cpu_nice = kstat_cpu(j).cpustat.nice;
513 idle_time += jiffies_to_usecs(cur_nice_jiffies);
516 if (unlikely(!wall_time || wall_time < idle_time))
519 load = 100 * (wall_time - idle_time) / wall_time;
521 freq_avg = __cpufreq_driver_getavg(policy, j);
523 freq_avg = policy->cur;
525 load_freq = load * freq_avg;
526 if (load_freq > max_load_freq)
527 max_load_freq = load_freq;
530 /* Check for frequency increase */
531 if (max_load_freq > dbs_tuners_ins.up_threshold * policy->cur) {
532 /* if we are already at full speed then break out early */
533 if (!dbs_tuners_ins.powersave_bias) {
534 if (policy->cur == policy->max)
537 __cpufreq_driver_target(policy, policy->max,
540 int freq = powersave_bias_target(policy, policy->max,
542 __cpufreq_driver_target(policy, freq,
548 /* Check for frequency decrease */
549 /* if we cannot reduce the frequency anymore, break out early */
550 if (policy->cur == policy->min)
554 * The optimal frequency is the frequency that is the lowest that
555 * can support the current CPU usage without triggering the up
556 * policy. To be safe, we focus 10 points under the threshold.
559 (dbs_tuners_ins.up_threshold - dbs_tuners_ins.down_differential) *
561 unsigned int freq_next;
562 freq_next = max_load_freq /
563 (dbs_tuners_ins.up_threshold -
564 dbs_tuners_ins.down_differential);
566 if (!dbs_tuners_ins.powersave_bias) {
567 __cpufreq_driver_target(policy, freq_next,
570 int freq = powersave_bias_target(policy, freq_next,
572 __cpufreq_driver_target(policy, freq,
578 static void do_dbs_timer(struct work_struct *work)
580 struct cpu_dbs_info_s *dbs_info =
581 container_of(work, struct cpu_dbs_info_s, work.work);
582 unsigned int cpu = dbs_info->cpu;
583 int sample_type = dbs_info->sample_type;
585 /* We want all CPUs to do sampling nearly on same jiffy */
586 int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate);
588 delay -= jiffies % delay;
589 mutex_lock(&dbs_info->timer_mutex);
591 /* Common NORMAL_SAMPLE setup */
592 dbs_info->sample_type = DBS_NORMAL_SAMPLE;
593 if (!dbs_tuners_ins.powersave_bias ||
594 sample_type == DBS_NORMAL_SAMPLE) {
595 dbs_check_cpu(dbs_info);
596 if (dbs_info->freq_lo) {
597 /* Setup timer for SUB_SAMPLE */
598 dbs_info->sample_type = DBS_SUB_SAMPLE;
599 delay = dbs_info->freq_hi_jiffies;
602 __cpufreq_driver_target(dbs_info->cur_policy,
603 dbs_info->freq_lo, CPUFREQ_RELATION_H);
605 queue_delayed_work_on(cpu, kondemand_wq, &dbs_info->work, delay);
606 mutex_unlock(&dbs_info->timer_mutex);
609 static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info)
611 /* We want all CPUs to do sampling nearly on same jiffy */
612 int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate);
613 delay -= jiffies % delay;
615 dbs_info->sample_type = DBS_NORMAL_SAMPLE;
616 INIT_DELAYED_WORK_DEFERRABLE(&dbs_info->work, do_dbs_timer);
617 queue_delayed_work_on(dbs_info->cpu, kondemand_wq, &dbs_info->work,
621 static inline void dbs_timer_exit(struct cpu_dbs_info_s *dbs_info)
623 cancel_delayed_work_sync(&dbs_info->work);
626 static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
629 unsigned int cpu = policy->cpu;
630 struct cpu_dbs_info_s *this_dbs_info;
634 this_dbs_info = &per_cpu(od_cpu_dbs_info, cpu);
637 case CPUFREQ_GOV_START:
638 if ((!cpu_online(cpu)) || (!policy->cur))
641 mutex_lock(&dbs_mutex);
643 rc = sysfs_create_group(&policy->kobj, &dbs_attr_group_old);
645 mutex_unlock(&dbs_mutex);
650 for_each_cpu(j, policy->cpus) {
651 struct cpu_dbs_info_s *j_dbs_info;
652 j_dbs_info = &per_cpu(od_cpu_dbs_info, j);
653 j_dbs_info->cur_policy = policy;
655 j_dbs_info->prev_cpu_idle = get_cpu_idle_time(j,
656 &j_dbs_info->prev_cpu_wall);
657 if (dbs_tuners_ins.ignore_nice) {
658 j_dbs_info->prev_cpu_nice =
659 kstat_cpu(j).cpustat.nice;
662 this_dbs_info->cpu = cpu;
663 ondemand_powersave_bias_init_cpu(cpu);
665 * Start the timerschedule work, when this governor
666 * is used for first time
668 if (dbs_enable == 1) {
669 unsigned int latency;
671 rc = sysfs_create_group(cpufreq_global_kobject,
674 mutex_unlock(&dbs_mutex);
678 /* policy latency is in nS. Convert it to uS first */
679 latency = policy->cpuinfo.transition_latency / 1000;
682 /* Bring kernel and HW constraints together */
683 min_sampling_rate = max(min_sampling_rate,
684 MIN_LATENCY_MULTIPLIER * latency);
685 dbs_tuners_ins.sampling_rate =
686 max(min_sampling_rate,
687 latency * LATENCY_MULTIPLIER);
689 mutex_unlock(&dbs_mutex);
691 mutex_init(&this_dbs_info->timer_mutex);
692 dbs_timer_init(this_dbs_info);
695 case CPUFREQ_GOV_STOP:
696 dbs_timer_exit(this_dbs_info);
698 mutex_lock(&dbs_mutex);
699 sysfs_remove_group(&policy->kobj, &dbs_attr_group_old);
700 mutex_destroy(&this_dbs_info->timer_mutex);
702 mutex_unlock(&dbs_mutex);
704 sysfs_remove_group(cpufreq_global_kobject,
709 case CPUFREQ_GOV_LIMITS:
710 mutex_lock(&this_dbs_info->timer_mutex);
711 if (policy->max < this_dbs_info->cur_policy->cur)
712 __cpufreq_driver_target(this_dbs_info->cur_policy,
713 policy->max, CPUFREQ_RELATION_H);
714 else if (policy->min > this_dbs_info->cur_policy->cur)
715 __cpufreq_driver_target(this_dbs_info->cur_policy,
716 policy->min, CPUFREQ_RELATION_L);
717 mutex_unlock(&this_dbs_info->timer_mutex);
723 static int __init cpufreq_gov_dbs_init(void)
730 idle_time = get_cpu_idle_time_us(cpu, &wall);
732 if (idle_time != -1ULL) {
733 /* Idle micro accounting is supported. Use finer thresholds */
734 dbs_tuners_ins.up_threshold = MICRO_FREQUENCY_UP_THRESHOLD;
735 dbs_tuners_ins.down_differential =
736 MICRO_FREQUENCY_DOWN_DIFFERENTIAL;
738 * In no_hz/micro accounting case we set the minimum frequency
739 * not depending on HZ, but fixed (very low). The deferred
740 * timer might skip some samples if idle/sleeping as needed.
742 min_sampling_rate = MICRO_FREQUENCY_MIN_SAMPLE_RATE;
744 /* For correct statistics, we need 10 ticks for each measure */
746 MIN_SAMPLING_RATE_RATIO * jiffies_to_usecs(10);
749 kondemand_wq = create_workqueue("kondemand");
751 printk(KERN_ERR "Creation of kondemand failed\n");
754 err = cpufreq_register_governor(&cpufreq_gov_ondemand);
756 destroy_workqueue(kondemand_wq);
761 static void __exit cpufreq_gov_dbs_exit(void)
763 cpufreq_unregister_governor(&cpufreq_gov_ondemand);
764 destroy_workqueue(kondemand_wq);
768 MODULE_AUTHOR("Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>");
769 MODULE_AUTHOR("Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>");
770 MODULE_DESCRIPTION("'cpufreq_ondemand' - A dynamic cpufreq governor for "
771 "Low Latency Frequency Transition capable processors");
772 MODULE_LICENSE("GPL");
774 #ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND
775 fs_initcall(cpufreq_gov_dbs_init);
777 module_init(cpufreq_gov_dbs_init);
779 module_exit(cpufreq_gov_dbs_exit);