blob: d0708c419aee3ad2cd989917daa1e245c5a97b79 [file] [log] [blame]
Mike Chan9d49b702010-06-22 11:26:45 -07001/*
2 * drivers/cpufreq/cpufreq_interactive.c
3 *
4 * Copyright (C) 2010 Google, Inc.
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * Author: Mike Chan (mike@android.com)
16 *
17 */
18
19#include <linux/cpu.h>
20#include <linux/cpumask.h>
21#include <linux/cpufreq.h>
22#include <linux/module.h>
23#include <linux/mutex.h>
24#include <linux/sched.h>
25#include <linux/tick.h>
26#include <linux/time.h>
27#include <linux/timer.h>
28#include <linux/workqueue.h>
29#include <linux/kthread.h>
30#include <linux/mutex.h>
31
Todd Poynora1e19512012-02-16 16:27:59 -080032#define CREATE_TRACE_POINTS
33#include <trace/events/cpufreq_interactive.h>
34
Mike Chan9d49b702010-06-22 11:26:45 -070035#include <asm/cputime.h>
36
37static atomic_t active_count = ATOMIC_INIT(0);
38
39struct cpufreq_interactive_cpuinfo {
40 struct timer_list cpu_timer;
41 int timer_idlecancel;
42 u64 time_in_idle;
43 u64 idle_exit_time;
44 u64 timer_run_time;
45 int idling;
46 u64 freq_change_time;
47 u64 freq_change_time_in_idle;
48 struct cpufreq_policy *policy;
49 struct cpufreq_frequency_table *freq_table;
50 unsigned int target_freq;
51 int governor_enabled;
52};
53
54static DEFINE_PER_CPU(struct cpufreq_interactive_cpuinfo, cpuinfo);
55
56/* Workqueues handle frequency scaling */
57static struct task_struct *up_task;
58static struct workqueue_struct *down_wq;
59static struct work_struct freq_scale_down_work;
60static cpumask_t up_cpumask;
61static spinlock_t up_cpumask_lock;
62static cpumask_t down_cpumask;
63static spinlock_t down_cpumask_lock;
64static struct mutex set_speed_lock;
65
66/* Hi speed to bump to from lo speed when load burst (default max) */
67static u64 hispeed_freq;
68
69/* Go to hi speed when CPU load at or above this value. */
70#define DEFAULT_GO_HISPEED_LOAD 95
71static unsigned long go_hispeed_load;
72
73/*
74 * The minimum amount of time to spend at a frequency before we can ramp down.
75 */
76#define DEFAULT_MIN_SAMPLE_TIME 20 * USEC_PER_MSEC
77static unsigned long min_sample_time;
78
79/*
80 * The sample rate of the timer used to increase frequency
81 */
82#define DEFAULT_TIMER_RATE 20 * USEC_PER_MSEC
83static unsigned long timer_rate;
84
85static int cpufreq_governor_interactive(struct cpufreq_policy *policy,
86 unsigned int event);
87
88#ifndef CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE
89static
90#endif
91struct cpufreq_governor cpufreq_gov_interactive = {
92 .name = "interactive",
93 .governor = cpufreq_governor_interactive,
94 .max_transition_latency = 10000000,
95 .owner = THIS_MODULE,
96};
97
98static void cpufreq_interactive_timer(unsigned long data)
99{
100 unsigned int delta_idle;
101 unsigned int delta_time;
102 int cpu_load;
103 int load_since_change;
104 u64 time_in_idle;
105 u64 idle_exit_time;
106 struct cpufreq_interactive_cpuinfo *pcpu =
107 &per_cpu(cpuinfo, data);
108 u64 now_idle;
109 unsigned int new_freq;
110 unsigned int index;
111 unsigned long flags;
112
113 smp_rmb();
114
115 if (!pcpu->governor_enabled)
116 goto exit;
117
118 /*
119 * Once pcpu->timer_run_time is updated to >= pcpu->idle_exit_time,
120 * this lets idle exit know the current idle time sample has
121 * been processed, and idle exit can generate a new sample and
122 * re-arm the timer. This prevents a concurrent idle
123 * exit on that CPU from writing a new set of info at the same time
124 * the timer function runs (the timer function can't use that info
125 * until more time passes).
126 */
127 time_in_idle = pcpu->time_in_idle;
128 idle_exit_time = pcpu->idle_exit_time;
129 now_idle = get_cpu_idle_time_us(data, &pcpu->timer_run_time);
130 smp_wmb();
131
132 /* If we raced with cancelling a timer, skip. */
133 if (!idle_exit_time)
134 goto exit;
135
136 delta_idle = (unsigned int)(now_idle - time_in_idle);
137 delta_time = (unsigned int)(pcpu->timer_run_time - idle_exit_time);
138
139 /*
140 * If timer ran less than 1ms after short-term sample started, retry.
141 */
142 if (delta_time < 1000)
143 goto rearm;
144
145 if (delta_idle > delta_time)
146 cpu_load = 0;
147 else
148 cpu_load = 100 * (delta_time - delta_idle) / delta_time;
149
150 delta_idle = (unsigned int)(now_idle - pcpu->freq_change_time_in_idle);
151 delta_time = (unsigned int)(pcpu->timer_run_time - pcpu->freq_change_time);
152
153 if ((delta_time == 0) || (delta_idle > delta_time))
154 load_since_change = 0;
155 else
156 load_since_change =
157 100 * (delta_time - delta_idle) / delta_time;
158
159 /*
160 * Choose greater of short-term load (since last idle timer
161 * started or timer function re-armed itself) or long-term load
162 * (since last frequency change).
163 */
164 if (load_since_change > cpu_load)
165 cpu_load = load_since_change;
166
167 if (cpu_load >= go_hispeed_load) {
168 if (pcpu->policy->cur == pcpu->policy->min)
169 new_freq = hispeed_freq;
170 else
171 new_freq = pcpu->policy->max * cpu_load / 100;
172 } else {
Todd Poynor1f53ef22012-04-06 01:13:09 -0700173 new_freq = pcpu->policy->max * cpu_load / 100;
Mike Chan9d49b702010-06-22 11:26:45 -0700174 }
175
176 if (cpufreq_frequency_table_target(pcpu->policy, pcpu->freq_table,
177 new_freq, CPUFREQ_RELATION_H,
178 &index)) {
179 pr_warn_once("timer %d: cpufreq_frequency_table_target error\n",
180 (int) data);
181 goto rearm;
182 }
183
184 new_freq = pcpu->freq_table[index].frequency;
185
186 if (pcpu->target_freq == new_freq)
Todd Poynora1e19512012-02-16 16:27:59 -0800187 {
188 trace_cpufreq_interactive_already(data, cpu_load,
189 pcpu->target_freq, new_freq);
Mike Chan9d49b702010-06-22 11:26:45 -0700190 goto rearm_if_notmax;
Todd Poynora1e19512012-02-16 16:27:59 -0800191 }
Mike Chan9d49b702010-06-22 11:26:45 -0700192
193 /*
194 * Do not scale down unless we have been at this frequency for the
195 * minimum sample time.
196 */
197 if (new_freq < pcpu->target_freq) {
198 if (pcpu->timer_run_time - pcpu->freq_change_time
Todd Poynora1e19512012-02-16 16:27:59 -0800199 < min_sample_time) {
200 trace_cpufreq_interactive_notyet(data, cpu_load,
201 pcpu->target_freq, new_freq);
Mike Chan9d49b702010-06-22 11:26:45 -0700202 goto rearm;
Todd Poynora1e19512012-02-16 16:27:59 -0800203 }
Mike Chan9d49b702010-06-22 11:26:45 -0700204 }
205
Todd Poynora1e19512012-02-16 16:27:59 -0800206 trace_cpufreq_interactive_target(data, cpu_load, pcpu->target_freq,
207 new_freq);
208
Mike Chan9d49b702010-06-22 11:26:45 -0700209 if (new_freq < pcpu->target_freq) {
210 pcpu->target_freq = new_freq;
211 spin_lock_irqsave(&down_cpumask_lock, flags);
212 cpumask_set_cpu(data, &down_cpumask);
213 spin_unlock_irqrestore(&down_cpumask_lock, flags);
214 queue_work(down_wq, &freq_scale_down_work);
215 } else {
216 pcpu->target_freq = new_freq;
217 spin_lock_irqsave(&up_cpumask_lock, flags);
218 cpumask_set_cpu(data, &up_cpumask);
219 spin_unlock_irqrestore(&up_cpumask_lock, flags);
220 wake_up_process(up_task);
221 }
222
223rearm_if_notmax:
224 /*
225 * Already set max speed and don't see a need to change that,
226 * wait until next idle to re-evaluate, don't need timer.
227 */
228 if (pcpu->target_freq == pcpu->policy->max)
229 goto exit;
230
231rearm:
232 if (!timer_pending(&pcpu->cpu_timer)) {
233 /*
234 * If already at min: if that CPU is idle, don't set timer.
235 * Else cancel the timer if that CPU goes idle. We don't
236 * need to re-evaluate speed until the next idle exit.
237 */
238 if (pcpu->target_freq == pcpu->policy->min) {
239 smp_rmb();
240
241 if (pcpu->idling)
242 goto exit;
243
244 pcpu->timer_idlecancel = 1;
245 }
246
247 pcpu->time_in_idle = get_cpu_idle_time_us(
248 data, &pcpu->idle_exit_time);
249 mod_timer(&pcpu->cpu_timer,
250 jiffies + usecs_to_jiffies(timer_rate));
251 }
252
253exit:
254 return;
255}
256
257static void cpufreq_interactive_idle_start(void)
258{
259 struct cpufreq_interactive_cpuinfo *pcpu =
260 &per_cpu(cpuinfo, smp_processor_id());
261 int pending;
262
263 if (!pcpu->governor_enabled)
264 return;
265
266 pcpu->idling = 1;
267 smp_wmb();
268 pending = timer_pending(&pcpu->cpu_timer);
269
270 if (pcpu->target_freq != pcpu->policy->min) {
271#ifdef CONFIG_SMP
272 /*
273 * Entering idle while not at lowest speed. On some
274 * platforms this can hold the other CPU(s) at that speed
275 * even though the CPU is idle. Set a timer to re-evaluate
276 * speed so this idle CPU doesn't hold the other CPUs above
277 * min indefinitely. This should probably be a quirk of
278 * the CPUFreq driver.
279 */
280 if (!pending) {
281 pcpu->time_in_idle = get_cpu_idle_time_us(
282 smp_processor_id(), &pcpu->idle_exit_time);
283 pcpu->timer_idlecancel = 0;
284 mod_timer(&pcpu->cpu_timer,
285 jiffies + usecs_to_jiffies(timer_rate));
286 }
287#endif
288 } else {
289 /*
290 * If at min speed and entering idle after load has
291 * already been evaluated, and a timer has been set just in
292 * case the CPU suddenly goes busy, cancel that timer. The
293 * CPU didn't go busy; we'll recheck things upon idle exit.
294 */
295 if (pending && pcpu->timer_idlecancel) {
296 del_timer(&pcpu->cpu_timer);
297 /*
298 * Ensure last timer run time is after current idle
299 * sample start time, so next idle exit will always
300 * start a new idle sampling period.
301 */
302 pcpu->idle_exit_time = 0;
303 pcpu->timer_idlecancel = 0;
304 }
305 }
306
307}
308
309static void cpufreq_interactive_idle_end(void)
310{
311 struct cpufreq_interactive_cpuinfo *pcpu =
312 &per_cpu(cpuinfo, smp_processor_id());
313
314 pcpu->idling = 0;
315 smp_wmb();
316
317 /*
318 * Arm the timer for 1-2 ticks later if not already, and if the timer
319 * function has already processed the previous load sampling
320 * interval. (If the timer is not pending but has not processed
321 * the previous interval, it is probably racing with us on another
322 * CPU. Let it compute load based on the previous sample and then
323 * re-arm the timer for another interval when it's done, rather
324 * than updating the interval start time to be "now", which doesn't
325 * give the timer function enough time to make a decision on this
326 * run.)
327 */
328 if (timer_pending(&pcpu->cpu_timer) == 0 &&
329 pcpu->timer_run_time >= pcpu->idle_exit_time &&
330 pcpu->governor_enabled) {
331 pcpu->time_in_idle =
332 get_cpu_idle_time_us(smp_processor_id(),
333 &pcpu->idle_exit_time);
334 pcpu->timer_idlecancel = 0;
335 mod_timer(&pcpu->cpu_timer,
336 jiffies + usecs_to_jiffies(timer_rate));
337 }
338
339}
340
341static int cpufreq_interactive_up_task(void *data)
342{
343 unsigned int cpu;
344 cpumask_t tmp_mask;
345 unsigned long flags;
346 struct cpufreq_interactive_cpuinfo *pcpu;
347
348 while (1) {
349 set_current_state(TASK_INTERRUPTIBLE);
350 spin_lock_irqsave(&up_cpumask_lock, flags);
351
352 if (cpumask_empty(&up_cpumask)) {
353 spin_unlock_irqrestore(&up_cpumask_lock, flags);
354 schedule();
355
356 if (kthread_should_stop())
357 break;
358
359 spin_lock_irqsave(&up_cpumask_lock, flags);
360 }
361
362 set_current_state(TASK_RUNNING);
363 tmp_mask = up_cpumask;
364 cpumask_clear(&up_cpumask);
365 spin_unlock_irqrestore(&up_cpumask_lock, flags);
366
367 for_each_cpu(cpu, &tmp_mask) {
368 unsigned int j;
369 unsigned int max_freq = 0;
370
371 pcpu = &per_cpu(cpuinfo, cpu);
372 smp_rmb();
373
374 if (!pcpu->governor_enabled)
375 continue;
376
377 mutex_lock(&set_speed_lock);
378
379 for_each_cpu(j, pcpu->policy->cpus) {
380 struct cpufreq_interactive_cpuinfo *pjcpu =
381 &per_cpu(cpuinfo, j);
382
383 if (pjcpu->target_freq > max_freq)
384 max_freq = pjcpu->target_freq;
385 }
386
387 if (max_freq != pcpu->policy->cur)
388 __cpufreq_driver_target(pcpu->policy,
389 max_freq,
390 CPUFREQ_RELATION_H);
391 mutex_unlock(&set_speed_lock);
392
393 pcpu->freq_change_time_in_idle =
394 get_cpu_idle_time_us(cpu,
395 &pcpu->freq_change_time);
Todd Poynora1e19512012-02-16 16:27:59 -0800396 trace_cpufreq_interactive_up(cpu, pcpu->target_freq,
397 pcpu->policy->cur);
Mike Chan9d49b702010-06-22 11:26:45 -0700398 }
399 }
400
401 return 0;
402}
403
404static void cpufreq_interactive_freq_down(struct work_struct *work)
405{
406 unsigned int cpu;
407 cpumask_t tmp_mask;
408 unsigned long flags;
409 struct cpufreq_interactive_cpuinfo *pcpu;
410
411 spin_lock_irqsave(&down_cpumask_lock, flags);
412 tmp_mask = down_cpumask;
413 cpumask_clear(&down_cpumask);
414 spin_unlock_irqrestore(&down_cpumask_lock, flags);
415
416 for_each_cpu(cpu, &tmp_mask) {
417 unsigned int j;
418 unsigned int max_freq = 0;
419
420 pcpu = &per_cpu(cpuinfo, cpu);
421 smp_rmb();
422
423 if (!pcpu->governor_enabled)
424 continue;
425
426 mutex_lock(&set_speed_lock);
427
428 for_each_cpu(j, pcpu->policy->cpus) {
429 struct cpufreq_interactive_cpuinfo *pjcpu =
430 &per_cpu(cpuinfo, j);
431
432 if (pjcpu->target_freq > max_freq)
433 max_freq = pjcpu->target_freq;
434 }
435
436 if (max_freq != pcpu->policy->cur)
437 __cpufreq_driver_target(pcpu->policy, max_freq,
438 CPUFREQ_RELATION_H);
439
440 mutex_unlock(&set_speed_lock);
441 pcpu->freq_change_time_in_idle =
442 get_cpu_idle_time_us(cpu,
443 &pcpu->freq_change_time);
Todd Poynora1e19512012-02-16 16:27:59 -0800444 trace_cpufreq_interactive_down(cpu, pcpu->target_freq,
445 pcpu->policy->cur);
Mike Chan9d49b702010-06-22 11:26:45 -0700446 }
447}
448
449static ssize_t show_hispeed_freq(struct kobject *kobj,
450 struct attribute *attr, char *buf)
451{
452 return sprintf(buf, "%llu\n", hispeed_freq);
453}
454
455static ssize_t store_hispeed_freq(struct kobject *kobj,
456 struct attribute *attr, const char *buf,
457 size_t count)
458{
459 int ret;
460 u64 val;
461
462 ret = strict_strtoull(buf, 0, &val);
463 if (ret < 0)
464 return ret;
465 hispeed_freq = val;
466 return count;
467}
468
469static struct global_attr hispeed_freq_attr = __ATTR(hispeed_freq, 0644,
470 show_hispeed_freq, store_hispeed_freq);
471
472
473static ssize_t show_go_hispeed_load(struct kobject *kobj,
474 struct attribute *attr, char *buf)
475{
476 return sprintf(buf, "%lu\n", go_hispeed_load);
477}
478
479static ssize_t store_go_hispeed_load(struct kobject *kobj,
480 struct attribute *attr, const char *buf, size_t count)
481{
482 int ret;
483 unsigned long val;
484
485 ret = strict_strtoul(buf, 0, &val);
486 if (ret < 0)
487 return ret;
488 go_hispeed_load = val;
489 return count;
490}
491
492static struct global_attr go_hispeed_load_attr = __ATTR(go_hispeed_load, 0644,
493 show_go_hispeed_load, store_go_hispeed_load);
494
495static ssize_t show_min_sample_time(struct kobject *kobj,
496 struct attribute *attr, char *buf)
497{
498 return sprintf(buf, "%lu\n", min_sample_time);
499}
500
501static ssize_t store_min_sample_time(struct kobject *kobj,
502 struct attribute *attr, const char *buf, size_t count)
503{
504 int ret;
505 unsigned long val;
506
507 ret = strict_strtoul(buf, 0, &val);
508 if (ret < 0)
509 return ret;
510 min_sample_time = val;
511 return count;
512}
513
514static struct global_attr min_sample_time_attr = __ATTR(min_sample_time, 0644,
515 show_min_sample_time, store_min_sample_time);
516
517static ssize_t show_timer_rate(struct kobject *kobj,
518 struct attribute *attr, char *buf)
519{
520 return sprintf(buf, "%lu\n", timer_rate);
521}
522
523static ssize_t store_timer_rate(struct kobject *kobj,
524 struct attribute *attr, const char *buf, size_t count)
525{
526 int ret;
527 unsigned long val;
528
529 ret = strict_strtoul(buf, 0, &val);
530 if (ret < 0)
531 return ret;
532 timer_rate = val;
533 return count;
534}
535
536static struct global_attr timer_rate_attr = __ATTR(timer_rate, 0644,
537 show_timer_rate, store_timer_rate);
538
539static struct attribute *interactive_attributes[] = {
540 &hispeed_freq_attr.attr,
541 &go_hispeed_load_attr.attr,
542 &min_sample_time_attr.attr,
543 &timer_rate_attr.attr,
544 NULL,
545};
546
547static struct attribute_group interactive_attr_group = {
548 .attrs = interactive_attributes,
549 .name = "interactive",
550};
551
552static int cpufreq_governor_interactive(struct cpufreq_policy *policy,
553 unsigned int event)
554{
555 int rc;
556 unsigned int j;
557 struct cpufreq_interactive_cpuinfo *pcpu;
558 struct cpufreq_frequency_table *freq_table;
559
560 switch (event) {
561 case CPUFREQ_GOV_START:
562 if (!cpu_online(policy->cpu))
563 return -EINVAL;
564
565 freq_table =
566 cpufreq_frequency_get_table(policy->cpu);
567
568 for_each_cpu(j, policy->cpus) {
569 pcpu = &per_cpu(cpuinfo, j);
570 pcpu->policy = policy;
571 pcpu->target_freq = policy->cur;
572 pcpu->freq_table = freq_table;
573 pcpu->freq_change_time_in_idle =
574 get_cpu_idle_time_us(j,
575 &pcpu->freq_change_time);
576 pcpu->governor_enabled = 1;
577 smp_wmb();
578 }
579
580 if (!hispeed_freq)
581 hispeed_freq = policy->max;
582
583 /*
584 * Do not register the idle hook and create sysfs
585 * entries if we have already done so.
586 */
587 if (atomic_inc_return(&active_count) > 1)
588 return 0;
589
590 rc = sysfs_create_group(cpufreq_global_kobject,
591 &interactive_attr_group);
592 if (rc)
593 return rc;
594
595 break;
596
597 case CPUFREQ_GOV_STOP:
598 for_each_cpu(j, policy->cpus) {
599 pcpu = &per_cpu(cpuinfo, j);
600 pcpu->governor_enabled = 0;
601 smp_wmb();
602 del_timer_sync(&pcpu->cpu_timer);
603
604 /*
605 * Reset idle exit time since we may cancel the timer
606 * before it can run after the last idle exit time,
607 * to avoid tripping the check in idle exit for a timer
608 * that is trying to run.
609 */
610 pcpu->idle_exit_time = 0;
611 }
612
613 flush_work(&freq_scale_down_work);
614 if (atomic_dec_return(&active_count) > 0)
615 return 0;
616
617 sysfs_remove_group(cpufreq_global_kobject,
618 &interactive_attr_group);
619
620 break;
621
622 case CPUFREQ_GOV_LIMITS:
623 if (policy->max < policy->cur)
624 __cpufreq_driver_target(policy,
625 policy->max, CPUFREQ_RELATION_H);
626 else if (policy->min > policy->cur)
627 __cpufreq_driver_target(policy,
628 policy->min, CPUFREQ_RELATION_L);
629 break;
630 }
631 return 0;
632}
633
634static int cpufreq_interactive_idle_notifier(struct notifier_block *nb,
635 unsigned long val,
636 void *data)
637{
638 switch (val) {
639 case IDLE_START:
640 cpufreq_interactive_idle_start();
641 break;
642 case IDLE_END:
643 cpufreq_interactive_idle_end();
644 break;
645 }
646
647 return 0;
648}
649
650static struct notifier_block cpufreq_interactive_idle_nb = {
651 .notifier_call = cpufreq_interactive_idle_notifier,
652};
653
654static int __init cpufreq_interactive_init(void)
655{
656 unsigned int i;
657 struct cpufreq_interactive_cpuinfo *pcpu;
658 struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 };
659
660 go_hispeed_load = DEFAULT_GO_HISPEED_LOAD;
661 min_sample_time = DEFAULT_MIN_SAMPLE_TIME;
662 timer_rate = DEFAULT_TIMER_RATE;
663
664 /* Initalize per-cpu timers */
665 for_each_possible_cpu(i) {
666 pcpu = &per_cpu(cpuinfo, i);
667 init_timer(&pcpu->cpu_timer);
668 pcpu->cpu_timer.function = cpufreq_interactive_timer;
669 pcpu->cpu_timer.data = i;
670 }
671
672 up_task = kthread_create(cpufreq_interactive_up_task, NULL,
673 "kinteractiveup");
674 if (IS_ERR(up_task))
675 return PTR_ERR(up_task);
676
677 sched_setscheduler_nocheck(up_task, SCHED_FIFO, &param);
678 get_task_struct(up_task);
679
680 /* No rescuer thread, bind to CPU queuing the work for possibly
681 warm cache (probably doesn't matter much). */
682 down_wq = alloc_workqueue("knteractive_down", 0, 1);
683
684 if (!down_wq)
685 goto err_freeuptask;
686
687 INIT_WORK(&freq_scale_down_work,
688 cpufreq_interactive_freq_down);
689
690 spin_lock_init(&up_cpumask_lock);
691 spin_lock_init(&down_cpumask_lock);
692 mutex_init(&set_speed_lock);
693
694 idle_notifier_register(&cpufreq_interactive_idle_nb);
695
696 return cpufreq_register_governor(&cpufreq_gov_interactive);
697
698err_freeuptask:
699 put_task_struct(up_task);
700 return -ENOMEM;
701}
702
703#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE
704fs_initcall(cpufreq_interactive_init);
705#else
706module_init(cpufreq_interactive_init);
707#endif
708
709static void __exit cpufreq_interactive_exit(void)
710{
711 cpufreq_unregister_governor(&cpufreq_gov_interactive);
712 kthread_stop(up_task);
713 put_task_struct(up_task);
714 destroy_workqueue(down_wq);
715}
716
717module_exit(cpufreq_interactive_exit);
718
719MODULE_AUTHOR("Mike Chan <mike@android.com>");
720MODULE_DESCRIPTION("'cpufreq_interactive' - A cpufreq governor for "
721 "Latency sensitive workloads");
722MODULE_LICENSE("GPL");