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