cpufreq_conservative.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. /*
  2. * drivers/cpufreq/cpufreq_conservative.c
  3. *
  4. * Copyright (C) 2001 Russell King
  5. * (C) 2003 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>.
  6. * Jun Nakajima <jun.nakajima@intel.com>
  7. * (C) 2009 Alexander Clouter <alex@digriz.org.uk>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/module.h>
  15. #include <linux/smp.h>
  16. #include <linux/init.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/ctype.h>
  19. #include <linux/cpufreq.h>
  20. #include <linux/sysctl.h>
  21. #include <linux/types.h>
  22. #include <linux/fs.h>
  23. #include <linux/sysfs.h>
  24. #include <linux/cpu.h>
  25. #include <linux/kmod.h>
  26. #include <linux/workqueue.h>
  27. #include <linux/jiffies.h>
  28. #include <linux/kernel_stat.h>
  29. #include <linux/percpu.h>
  30. #include <linux/mutex.h>
  31. /*
  32. * dbs is used in this file as a shortform for demandbased switching
  33. * It helps to keep variable names smaller, simpler
  34. */
  35. #define DEF_FREQUENCY_UP_THRESHOLD (80)
  36. #define DEF_FREQUENCY_DOWN_THRESHOLD (20)
  37. /*
  38. * The polling frequency of this governor depends on the capability of
  39. * the processor. Default polling frequency is 1000 times the transition
  40. * latency of the processor. The governor will work on any processor with
  41. * transition latency <= 10mS, using appropriate sampling
  42. * rate.
  43. * For CPUs with transition latency > 10mS (mostly drivers
  44. * with CPUFREQ_ETERNAL), this governor will not work.
  45. * All times here are in uS.
  46. */
  47. static unsigned int def_sampling_rate;
  48. #define MIN_SAMPLING_RATE_RATIO (2)
  49. /* for correct statistics, we need at least 10 ticks between each measure */
  50. #define MIN_STAT_SAMPLING_RATE \
  51. (MIN_SAMPLING_RATE_RATIO * jiffies_to_usecs(10))
  52. #define MIN_SAMPLING_RATE \
  53. (def_sampling_rate / MIN_SAMPLING_RATE_RATIO)
  54. /* Above MIN_SAMPLING_RATE will vanish with its sysfs file soon
  55. * Define the minimal settable sampling rate to the greater of:
  56. * - "HW transition latency" * 100 (same as default sampling / 10)
  57. * - MIN_STAT_SAMPLING_RATE
  58. * To avoid that userspace shoots itself.
  59. */
  60. static unsigned int minimum_sampling_rate(void)
  61. {
  62. return max(def_sampling_rate / 10, MIN_STAT_SAMPLING_RATE);
  63. }
  64. /* This will also vanish soon with removing sampling_rate_max */
  65. #define MAX_SAMPLING_RATE (500 * def_sampling_rate)
  66. #define LATENCY_MULTIPLIER (1000)
  67. #define DEF_SAMPLING_DOWN_FACTOR (1)
  68. #define MAX_SAMPLING_DOWN_FACTOR (10)
  69. #define TRANSITION_LATENCY_LIMIT (10 * 1000 * 1000)
  70. static void do_dbs_timer(struct work_struct *work);
  71. struct cpu_dbs_info_s {
  72. struct cpufreq_policy *cur_policy;
  73. unsigned int prev_cpu_idle_up;
  74. unsigned int prev_cpu_idle_down;
  75. unsigned int enable;
  76. unsigned int down_skip;
  77. unsigned int requested_freq;
  78. };
  79. static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info);
  80. static unsigned int dbs_enable; /* number of CPUs using this policy */
  81. /*
  82. * DEADLOCK ALERT! There is a ordering requirement between cpu_hotplug
  83. * lock and dbs_mutex. cpu_hotplug lock should always be held before
  84. * dbs_mutex. If any function that can potentially take cpu_hotplug lock
  85. * (like __cpufreq_driver_target()) is being called with dbs_mutex taken, then
  86. * cpu_hotplug lock should be taken before that. Note that cpu_hotplug lock
  87. * is recursive for the same process. -Venki
  88. */
  89. static DEFINE_MUTEX(dbs_mutex);
  90. static DECLARE_DELAYED_WORK(dbs_work, do_dbs_timer);
  91. struct dbs_tuners {
  92. unsigned int sampling_rate;
  93. unsigned int sampling_down_factor;
  94. unsigned int up_threshold;
  95. unsigned int down_threshold;
  96. unsigned int ignore_nice;
  97. unsigned int freq_step;
  98. };
  99. static struct dbs_tuners dbs_tuners_ins = {
  100. .up_threshold = DEF_FREQUENCY_UP_THRESHOLD,
  101. .down_threshold = DEF_FREQUENCY_DOWN_THRESHOLD,
  102. .sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR,
  103. .ignore_nice = 0,
  104. .freq_step = 5,
  105. };
  106. static inline unsigned int get_cpu_idle_time(unsigned int cpu)
  107. {
  108. unsigned int add_nice = 0, ret;
  109. if (dbs_tuners_ins.ignore_nice)
  110. add_nice = kstat_cpu(cpu).cpustat.nice;
  111. ret = kstat_cpu(cpu).cpustat.idle +
  112. kstat_cpu(cpu).cpustat.iowait +
  113. add_nice;
  114. return ret;
  115. }
  116. /* keep track of frequency transitions */
  117. static int
  118. dbs_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
  119. void *data)
  120. {
  121. struct cpufreq_freqs *freq = data;
  122. struct cpu_dbs_info_s *this_dbs_info = &per_cpu(cpu_dbs_info,
  123. freq->cpu);
  124. struct cpufreq_policy *policy;
  125. if (!this_dbs_info->enable)
  126. return 0;
  127. policy = this_dbs_info->cur_policy;
  128. /*
  129. * we only care if our internally tracked freq moves outside
  130. * the 'valid' ranges of freqency available to us otherwise
  131. * we do not change it
  132. */
  133. if (this_dbs_info->requested_freq > policy->max
  134. || this_dbs_info->requested_freq < policy->min)
  135. this_dbs_info->requested_freq = freq->new;
  136. return 0;
  137. }
  138. static struct notifier_block dbs_cpufreq_notifier_block = {
  139. .notifier_call = dbs_cpufreq_notifier
  140. };
  141. /************************** sysfs interface ************************/
  142. static ssize_t show_sampling_rate_max(struct cpufreq_policy *policy, char *buf)
  143. {
  144. static int print_once;
  145. if (!print_once) {
  146. printk(KERN_INFO "CPUFREQ: conservative sampling_rate_max "
  147. "sysfs file is deprecated - used by: %s\n",
  148. current->comm);
  149. print_once = 1;
  150. }
  151. return sprintf(buf, "%u\n", MAX_SAMPLING_RATE);
  152. }
  153. static ssize_t show_sampling_rate_min(struct cpufreq_policy *policy, char *buf)
  154. {
  155. static int print_once;
  156. if (!print_once) {
  157. printk(KERN_INFO "CPUFREQ: conservative sampling_rate_max "
  158. "sysfs file is deprecated - used by: %s\n", current->comm);
  159. print_once = 1;
  160. }
  161. return sprintf(buf, "%u\n", MIN_SAMPLING_RATE);
  162. }
  163. #define define_one_ro(_name) \
  164. static struct freq_attr _name = \
  165. __ATTR(_name, 0444, show_##_name, NULL)
  166. define_one_ro(sampling_rate_max);
  167. define_one_ro(sampling_rate_min);
  168. /* cpufreq_conservative Governor Tunables */
  169. #define show_one(file_name, object) \
  170. static ssize_t show_##file_name \
  171. (struct cpufreq_policy *unused, char *buf) \
  172. { \
  173. return sprintf(buf, "%u\n", dbs_tuners_ins.object); \
  174. }
  175. show_one(sampling_rate, sampling_rate);
  176. show_one(sampling_down_factor, sampling_down_factor);
  177. show_one(up_threshold, up_threshold);
  178. show_one(down_threshold, down_threshold);
  179. show_one(ignore_nice_load, ignore_nice);
  180. show_one(freq_step, freq_step);
  181. static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused,
  182. const char *buf, size_t count)
  183. {
  184. unsigned int input;
  185. int ret;
  186. ret = sscanf(buf, "%u", &input);
  187. if (ret != 1 || input > MAX_SAMPLING_DOWN_FACTOR || input < 1)
  188. return -EINVAL;
  189. mutex_lock(&dbs_mutex);
  190. dbs_tuners_ins.sampling_down_factor = input;
  191. mutex_unlock(&dbs_mutex);
  192. return count;
  193. }
  194. static ssize_t store_sampling_rate(struct cpufreq_policy *unused,
  195. const char *buf, size_t count)
  196. {
  197. unsigned int input;
  198. int ret;
  199. ret = sscanf(buf, "%u", &input);
  200. mutex_lock(&dbs_mutex);
  201. if (ret != 1) {
  202. mutex_unlock(&dbs_mutex);
  203. return -EINVAL;
  204. }
  205. dbs_tuners_ins.sampling_rate = max(input, minimum_sampling_rate());
  206. mutex_unlock(&dbs_mutex);
  207. return count;
  208. }
  209. static ssize_t store_up_threshold(struct cpufreq_policy *unused,
  210. const char *buf, size_t count)
  211. {
  212. unsigned int input;
  213. int ret;
  214. ret = sscanf(buf, "%u", &input);
  215. mutex_lock(&dbs_mutex);
  216. if (ret != 1 || input > 100 ||
  217. input <= dbs_tuners_ins.down_threshold) {
  218. mutex_unlock(&dbs_mutex);
  219. return -EINVAL;
  220. }
  221. dbs_tuners_ins.up_threshold = input;
  222. mutex_unlock(&dbs_mutex);
  223. return count;
  224. }
  225. static ssize_t store_down_threshold(struct cpufreq_policy *unused,
  226. const char *buf, size_t count)
  227. {
  228. unsigned int input;
  229. int ret;
  230. ret = sscanf(buf, "%u", &input);
  231. mutex_lock(&dbs_mutex);
  232. if (ret != 1 || input > 100 || input >= dbs_tuners_ins.up_threshold) {
  233. mutex_unlock(&dbs_mutex);
  234. return -EINVAL;
  235. }
  236. dbs_tuners_ins.down_threshold = input;
  237. mutex_unlock(&dbs_mutex);
  238. return count;
  239. }
  240. static ssize_t store_ignore_nice_load(struct cpufreq_policy *policy,
  241. const char *buf, size_t count)
  242. {
  243. unsigned int input;
  244. int ret;
  245. unsigned int j;
  246. ret = sscanf(buf, "%u", &input);
  247. if (ret != 1)
  248. return -EINVAL;
  249. if (input > 1)
  250. input = 1;
  251. mutex_lock(&dbs_mutex);
  252. if (input == dbs_tuners_ins.ignore_nice) { /* nothing to do */
  253. mutex_unlock(&dbs_mutex);
  254. return count;
  255. }
  256. dbs_tuners_ins.ignore_nice = input;
  257. /* we need to re-evaluate prev_cpu_idle_up and prev_cpu_idle_down */
  258. for_each_online_cpu(j) {
  259. struct cpu_dbs_info_s *j_dbs_info;
  260. j_dbs_info = &per_cpu(cpu_dbs_info, j);
  261. j_dbs_info->prev_cpu_idle_up = get_cpu_idle_time(j);
  262. j_dbs_info->prev_cpu_idle_down = j_dbs_info->prev_cpu_idle_up;
  263. }
  264. mutex_unlock(&dbs_mutex);
  265. return count;
  266. }
  267. static ssize_t store_freq_step(struct cpufreq_policy *policy,
  268. const char *buf, size_t count)
  269. {
  270. unsigned int input;
  271. int ret;
  272. ret = sscanf(buf, "%u", &input);
  273. if (ret != 1)
  274. return -EINVAL;
  275. if (input > 100)
  276. input = 100;
  277. /* no need to test here if freq_step is zero as the user might actually
  278. * want this, they would be crazy though :) */
  279. mutex_lock(&dbs_mutex);
  280. dbs_tuners_ins.freq_step = input;
  281. mutex_unlock(&dbs_mutex);
  282. return count;
  283. }
  284. #define define_one_rw(_name) \
  285. static struct freq_attr _name = \
  286. __ATTR(_name, 0644, show_##_name, store_##_name)
  287. define_one_rw(sampling_rate);
  288. define_one_rw(sampling_down_factor);
  289. define_one_rw(up_threshold);
  290. define_one_rw(down_threshold);
  291. define_one_rw(ignore_nice_load);
  292. define_one_rw(freq_step);
  293. static struct attribute *dbs_attributes[] = {
  294. &sampling_rate_max.attr,
  295. &sampling_rate_min.attr,
  296. &sampling_rate.attr,
  297. &sampling_down_factor.attr,
  298. &up_threshold.attr,
  299. &down_threshold.attr,
  300. &ignore_nice_load.attr,
  301. &freq_step.attr,
  302. NULL
  303. };
  304. static struct attribute_group dbs_attr_group = {
  305. .attrs = dbs_attributes,
  306. .name = "conservative",
  307. };
  308. /************************** sysfs end ************************/
  309. static void dbs_check_cpu(int cpu)
  310. {
  311. unsigned int idle_ticks, up_idle_ticks, down_idle_ticks;
  312. unsigned int tmp_idle_ticks, total_idle_ticks;
  313. unsigned int freq_target;
  314. unsigned int freq_down_sampling_rate;
  315. struct cpu_dbs_info_s *this_dbs_info = &per_cpu(cpu_dbs_info, cpu);
  316. struct cpufreq_policy *policy;
  317. if (!this_dbs_info->enable)
  318. return;
  319. policy = this_dbs_info->cur_policy;
  320. /*
  321. * The default safe range is 20% to 80%
  322. * Every sampling_rate, we check
  323. * - If current idle time is less than 20%, then we try to
  324. * increase frequency
  325. * Every sampling_rate*sampling_down_factor, we check
  326. * - If current idle time is more than 80%, then we try to
  327. * decrease frequency
  328. *
  329. * Any frequency increase takes it to the maximum frequency.
  330. * Frequency reduction happens at minimum steps of
  331. * 5% (default) of max_frequency
  332. */
  333. /* Check for frequency increase */
  334. idle_ticks = UINT_MAX;
  335. /* Check for frequency increase */
  336. total_idle_ticks = get_cpu_idle_time(cpu);
  337. tmp_idle_ticks = total_idle_ticks -
  338. this_dbs_info->prev_cpu_idle_up;
  339. this_dbs_info->prev_cpu_idle_up = total_idle_ticks;
  340. if (tmp_idle_ticks < idle_ticks)
  341. idle_ticks = tmp_idle_ticks;
  342. /* Scale idle ticks by 100 and compare with up and down ticks */
  343. idle_ticks *= 100;
  344. up_idle_ticks = (100 - dbs_tuners_ins.up_threshold) *
  345. usecs_to_jiffies(dbs_tuners_ins.sampling_rate);
  346. if (idle_ticks < up_idle_ticks) {
  347. this_dbs_info->down_skip = 0;
  348. this_dbs_info->prev_cpu_idle_down =
  349. this_dbs_info->prev_cpu_idle_up;
  350. /* if we are already at full speed then break out early */
  351. if (this_dbs_info->requested_freq == policy->max)
  352. return;
  353. freq_target = (dbs_tuners_ins.freq_step * policy->max) / 100;
  354. /* max freq cannot be less than 100. But who knows.... */
  355. if (unlikely(freq_target == 0))
  356. freq_target = 5;
  357. this_dbs_info->requested_freq += freq_target;
  358. if (this_dbs_info->requested_freq > policy->max)
  359. this_dbs_info->requested_freq = policy->max;
  360. __cpufreq_driver_target(policy, this_dbs_info->requested_freq,
  361. CPUFREQ_RELATION_H);
  362. return;
  363. }
  364. /* Check for frequency decrease */
  365. this_dbs_info->down_skip++;
  366. if (this_dbs_info->down_skip < dbs_tuners_ins.sampling_down_factor)
  367. return;
  368. /* Check for frequency decrease */
  369. total_idle_ticks = this_dbs_info->prev_cpu_idle_up;
  370. tmp_idle_ticks = total_idle_ticks -
  371. this_dbs_info->prev_cpu_idle_down;
  372. this_dbs_info->prev_cpu_idle_down = total_idle_ticks;
  373. if (tmp_idle_ticks < idle_ticks)
  374. idle_ticks = tmp_idle_ticks;
  375. /* Scale idle ticks by 100 and compare with up and down ticks */
  376. idle_ticks *= 100;
  377. this_dbs_info->down_skip = 0;
  378. freq_down_sampling_rate = dbs_tuners_ins.sampling_rate *
  379. dbs_tuners_ins.sampling_down_factor;
  380. down_idle_ticks = (100 - dbs_tuners_ins.down_threshold) *
  381. usecs_to_jiffies(freq_down_sampling_rate);
  382. if (idle_ticks > down_idle_ticks) {
  383. /*
  384. * if we are already at the lowest speed then break out early
  385. * or if we 'cannot' reduce the speed as the user might want
  386. * freq_target to be zero
  387. */
  388. if (this_dbs_info->requested_freq == policy->min
  389. || dbs_tuners_ins.freq_step == 0)
  390. return;
  391. freq_target = (dbs_tuners_ins.freq_step * policy->max) / 100;
  392. /* max freq cannot be less than 100. But who knows.... */
  393. if (unlikely(freq_target == 0))
  394. freq_target = 5;
  395. this_dbs_info->requested_freq -= freq_target;
  396. if (this_dbs_info->requested_freq < policy->min)
  397. this_dbs_info->requested_freq = policy->min;
  398. __cpufreq_driver_target(policy, this_dbs_info->requested_freq,
  399. CPUFREQ_RELATION_H);
  400. return;
  401. }
  402. }
  403. static void do_dbs_timer(struct work_struct *work)
  404. {
  405. int i;
  406. mutex_lock(&dbs_mutex);
  407. for_each_online_cpu(i)
  408. dbs_check_cpu(i);
  409. schedule_delayed_work(&dbs_work,
  410. usecs_to_jiffies(dbs_tuners_ins.sampling_rate));
  411. mutex_unlock(&dbs_mutex);
  412. }
  413. static inline void dbs_timer_init(void)
  414. {
  415. init_timer_deferrable(&dbs_work.timer);
  416. schedule_delayed_work(&dbs_work,
  417. usecs_to_jiffies(dbs_tuners_ins.sampling_rate));
  418. return;
  419. }
  420. static inline void dbs_timer_exit(void)
  421. {
  422. cancel_delayed_work(&dbs_work);
  423. return;
  424. }
  425. static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
  426. unsigned int event)
  427. {
  428. unsigned int cpu = policy->cpu;
  429. struct cpu_dbs_info_s *this_dbs_info;
  430. unsigned int j;
  431. int rc;
  432. this_dbs_info = &per_cpu(cpu_dbs_info, cpu);
  433. switch (event) {
  434. case CPUFREQ_GOV_START:
  435. if ((!cpu_online(cpu)) || (!policy->cur))
  436. return -EINVAL;
  437. if (this_dbs_info->enable) /* Already enabled */
  438. break;
  439. mutex_lock(&dbs_mutex);
  440. rc = sysfs_create_group(&policy->kobj, &dbs_attr_group);
  441. if (rc) {
  442. mutex_unlock(&dbs_mutex);
  443. return rc;
  444. }
  445. for_each_cpu(j, policy->cpus) {
  446. struct cpu_dbs_info_s *j_dbs_info;
  447. j_dbs_info = &per_cpu(cpu_dbs_info, j);
  448. j_dbs_info->cur_policy = policy;
  449. j_dbs_info->prev_cpu_idle_up = get_cpu_idle_time(cpu);
  450. j_dbs_info->prev_cpu_idle_down
  451. = j_dbs_info->prev_cpu_idle_up;
  452. }
  453. this_dbs_info->enable = 1;
  454. this_dbs_info->down_skip = 0;
  455. this_dbs_info->requested_freq = policy->cur;
  456. dbs_enable++;
  457. /*
  458. * Start the timerschedule work, when this governor
  459. * is used for first time
  460. */
  461. if (dbs_enable == 1) {
  462. unsigned int latency;
  463. /* policy latency is in nS. Convert it to uS first */
  464. latency = policy->cpuinfo.transition_latency / 1000;
  465. if (latency == 0)
  466. latency = 1;
  467. def_sampling_rate =
  468. max(10 * latency * LATENCY_MULTIPLIER,
  469. MIN_STAT_SAMPLING_RATE);
  470. dbs_tuners_ins.sampling_rate = def_sampling_rate;
  471. dbs_timer_init();
  472. cpufreq_register_notifier(
  473. &dbs_cpufreq_notifier_block,
  474. CPUFREQ_TRANSITION_NOTIFIER);
  475. }
  476. mutex_unlock(&dbs_mutex);
  477. break;
  478. case CPUFREQ_GOV_STOP:
  479. mutex_lock(&dbs_mutex);
  480. this_dbs_info->enable = 0;
  481. sysfs_remove_group(&policy->kobj, &dbs_attr_group);
  482. dbs_enable--;
  483. /*
  484. * Stop the timerschedule work, when this governor
  485. * is used for first time
  486. */
  487. if (dbs_enable == 0) {
  488. dbs_timer_exit();
  489. cpufreq_unregister_notifier(
  490. &dbs_cpufreq_notifier_block,
  491. CPUFREQ_TRANSITION_NOTIFIER);
  492. }
  493. mutex_unlock(&dbs_mutex);
  494. break;
  495. case CPUFREQ_GOV_LIMITS:
  496. mutex_lock(&dbs_mutex);
  497. if (policy->max < this_dbs_info->cur_policy->cur)
  498. __cpufreq_driver_target(
  499. this_dbs_info->cur_policy,
  500. policy->max, CPUFREQ_RELATION_H);
  501. else if (policy->min > this_dbs_info->cur_policy->cur)
  502. __cpufreq_driver_target(
  503. this_dbs_info->cur_policy,
  504. policy->min, CPUFREQ_RELATION_L);
  505. mutex_unlock(&dbs_mutex);
  506. break;
  507. }
  508. return 0;
  509. }
  510. #ifndef CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE
  511. static
  512. #endif
  513. struct cpufreq_governor cpufreq_gov_conservative = {
  514. .name = "conservative",
  515. .governor = cpufreq_governor_dbs,
  516. .max_transition_latency = TRANSITION_LATENCY_LIMIT,
  517. .owner = THIS_MODULE,
  518. };
  519. static int __init cpufreq_gov_dbs_init(void)
  520. {
  521. return cpufreq_register_governor(&cpufreq_gov_conservative);
  522. }
  523. static void __exit cpufreq_gov_dbs_exit(void)
  524. {
  525. /* Make sure that the scheduled work is indeed not running */
  526. flush_scheduled_work();
  527. cpufreq_unregister_governor(&cpufreq_gov_conservative);
  528. }
  529. MODULE_AUTHOR("Alexander Clouter <alex@digriz.org.uk>");
  530. MODULE_DESCRIPTION("'cpufreq_conservative' - A dynamic cpufreq governor for "
  531. "Low Latency Frequency Transition capable processors "
  532. "optimised for use in a battery environment");
  533. MODULE_LICENSE("GPL");
  534. #ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE
  535. fs_initcall(cpufreq_gov_dbs_init);
  536. #else
  537. module_init(cpufreq_gov_dbs_init);
  538. #endif
  539. module_exit(cpufreq_gov_dbs_exit);