Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * drivers/cpufreq/cpufreq_ondemand.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 | * |
| 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. |
| 11 | */ |
| 12 | |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/module.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | #include <linux/init.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | #include <linux/cpufreq.h> |
Andrew Morton | 138a0128 | 2006-06-23 03:31:19 -0700 | [diff] [blame] | 17 | #include <linux/cpu.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | #include <linux/jiffies.h> |
| 19 | #include <linux/kernel_stat.h> |
akpm@osdl.org | 3fc54d3 | 2006-01-13 15:54:22 -0800 | [diff] [blame] | 20 | #include <linux/mutex.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | |
| 22 | /* |
| 23 | * dbs is used in this file as a shortform for demandbased switching |
| 24 | * It helps to keep variable names smaller, simpler |
| 25 | */ |
| 26 | |
| 27 | #define DEF_FREQUENCY_UP_THRESHOLD (80) |
Dave Jones | c29f140 | 2005-05-31 19:03:50 -0700 | [diff] [blame] | 28 | #define MIN_FREQUENCY_UP_THRESHOLD (11) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | #define MAX_FREQUENCY_UP_THRESHOLD (100) |
| 30 | |
Dave Jones | 32ee8c3 | 2006-02-28 00:43:23 -0500 | [diff] [blame] | 31 | /* |
| 32 | * The polling frequency of this governor depends on the capability of |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | * the processor. Default polling frequency is 1000 times the transition |
Dave Jones | 32ee8c3 | 2006-02-28 00:43:23 -0500 | [diff] [blame] | 34 | * latency of the processor. The governor will work on any processor with |
| 35 | * transition latency <= 10mS, using appropriate sampling |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | * rate. |
| 37 | * For CPUs with transition latency > 10mS (mostly drivers with CPUFREQ_ETERNAL) |
| 38 | * this governor will not work. |
| 39 | * All times here are in uS. |
| 40 | */ |
Dave Jones | 32ee8c3 | 2006-02-28 00:43:23 -0500 | [diff] [blame] | 41 | static unsigned int def_sampling_rate; |
Dave Jones | df8b59b | 2005-09-20 12:39:35 -0700 | [diff] [blame] | 42 | #define MIN_SAMPLING_RATE_RATIO (2) |
| 43 | /* for correct statistics, we need at least 10 ticks between each measure */ |
| 44 | #define MIN_STAT_SAMPLING_RATE (MIN_SAMPLING_RATE_RATIO * jiffies_to_usecs(10)) |
| 45 | #define MIN_SAMPLING_RATE (def_sampling_rate / MIN_SAMPLING_RATE_RATIO) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | #define MAX_SAMPLING_RATE (500 * def_sampling_rate) |
| 47 | #define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | #define TRANSITION_LATENCY_LIMIT (10 * 1000) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | |
| 50 | static void do_dbs_timer(void *data); |
| 51 | |
| 52 | struct cpu_dbs_info_s { |
Venkatesh Pallipadi | ccb2fe2 | 2006-06-28 13:49:52 -0700 | [diff] [blame] | 53 | cputime64_t prev_cpu_idle; |
| 54 | cputime64_t prev_cpu_wall; |
Dave Jones | 32ee8c3 | 2006-02-28 00:43:23 -0500 | [diff] [blame] | 55 | struct cpufreq_policy *cur_policy; |
Venkatesh Pallipadi | 2f8a835 | 2006-06-28 13:51:19 -0700 | [diff] [blame] | 56 | struct work_struct work; |
Dave Jones | 32ee8c3 | 2006-02-28 00:43:23 -0500 | [diff] [blame] | 57 | unsigned int enable; |
Alexey Starikovskiy | 05ca035 | 2006-07-31 22:28:12 +0400 | [diff] [blame] | 58 | struct cpufreq_frequency_table *freq_table; |
| 59 | unsigned int freq_lo; |
| 60 | unsigned int freq_lo_jiffies; |
| 61 | unsigned int freq_hi_jiffies; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | }; |
| 63 | static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info); |
| 64 | |
| 65 | static unsigned int dbs_enable; /* number of CPUs using this policy */ |
| 66 | |
Venkatesh Pallipadi | 4ec223d | 2006-06-21 15:18:34 -0700 | [diff] [blame] | 67 | /* |
| 68 | * DEADLOCK ALERT! There is a ordering requirement between cpu_hotplug |
| 69 | * lock and dbs_mutex. cpu_hotplug lock should always be held before |
| 70 | * dbs_mutex. If any function that can potentially take cpu_hotplug lock |
| 71 | * (like __cpufreq_driver_target()) is being called with dbs_mutex taken, then |
| 72 | * cpu_hotplug lock should be taken before that. Note that cpu_hotplug lock |
| 73 | * is recursive for the same process. -Venki |
| 74 | */ |
Venkatesh Pallipadi | ffac80e | 2006-06-28 13:52:18 -0700 | [diff] [blame] | 75 | static DEFINE_MUTEX(dbs_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 76 | |
Venkatesh Pallipadi | 2f8a835 | 2006-06-28 13:51:19 -0700 | [diff] [blame] | 77 | static struct workqueue_struct *kondemand_wq; |
Andi Kleen | 6810b54 | 2006-05-08 15:17:31 +0200 | [diff] [blame] | 78 | |
Alexey Starikovskiy | 05ca035 | 2006-07-31 22:28:12 +0400 | [diff] [blame] | 79 | static struct dbs_tuners { |
Dave Jones | 32ee8c3 | 2006-02-28 00:43:23 -0500 | [diff] [blame] | 80 | unsigned int sampling_rate; |
Dave Jones | 32ee8c3 | 2006-02-28 00:43:23 -0500 | [diff] [blame] | 81 | unsigned int up_threshold; |
| 82 | unsigned int ignore_nice; |
Alexey Starikovskiy | 05ca035 | 2006-07-31 22:28:12 +0400 | [diff] [blame] | 83 | unsigned int powersave_bias; |
| 84 | } dbs_tuners_ins = { |
Dave Jones | 32ee8c3 | 2006-02-28 00:43:23 -0500 | [diff] [blame] | 85 | .up_threshold = DEF_FREQUENCY_UP_THRESHOLD, |
Eric Piel | 9cbad61 | 2006-03-10 11:35:27 +0200 | [diff] [blame] | 86 | .ignore_nice = 0, |
Alexey Starikovskiy | 05ca035 | 2006-07-31 22:28:12 +0400 | [diff] [blame] | 87 | .powersave_bias = 0, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | }; |
| 89 | |
Venkatesh Pallipadi | ccb2fe2 | 2006-06-28 13:49:52 -0700 | [diff] [blame] | 90 | static inline cputime64_t get_cpu_idle_time(unsigned int cpu) |
Dave Jones | dac1c1a | 2005-05-31 19:03:49 -0700 | [diff] [blame] | 91 | { |
Venkatesh Pallipadi | ccb2fe2 | 2006-06-28 13:49:52 -0700 | [diff] [blame] | 92 | cputime64_t retval; |
| 93 | |
| 94 | retval = cputime64_add(kstat_cpu(cpu).cpustat.idle, |
| 95 | kstat_cpu(cpu).cpustat.iowait); |
| 96 | |
| 97 | if (dbs_tuners_ins.ignore_nice) |
| 98 | retval = cputime64_add(retval, kstat_cpu(cpu).cpustat.nice); |
| 99 | |
| 100 | return retval; |
Dave Jones | dac1c1a | 2005-05-31 19:03:49 -0700 | [diff] [blame] | 101 | } |
| 102 | |
Alexey Starikovskiy | 05ca035 | 2006-07-31 22:28:12 +0400 | [diff] [blame] | 103 | /* |
| 104 | * Find right freq to be set now with powersave_bias on. |
| 105 | * Returns the freq_hi to be used right now and will set freq_hi_jiffies, |
| 106 | * freq_lo, and freq_lo_jiffies in percpu area for averaging freqs. |
| 107 | */ |
Adrian Bunk | b5ecf60 | 2006-08-13 23:00:08 +0200 | [diff] [blame^] | 108 | static unsigned int powersave_bias_target(struct cpufreq_policy *policy, |
| 109 | unsigned int freq_next, |
| 110 | unsigned int relation) |
Alexey Starikovskiy | 05ca035 | 2006-07-31 22:28:12 +0400 | [diff] [blame] | 111 | { |
| 112 | unsigned int freq_req, freq_reduc, freq_avg; |
| 113 | unsigned int freq_hi, freq_lo; |
| 114 | unsigned int index = 0; |
| 115 | unsigned int jiffies_total, jiffies_hi, jiffies_lo; |
| 116 | struct cpu_dbs_info_s *dbs_info = &per_cpu(cpu_dbs_info, policy->cpu); |
| 117 | |
| 118 | if (!dbs_info->freq_table) { |
| 119 | dbs_info->freq_lo = 0; |
| 120 | dbs_info->freq_lo_jiffies = 0; |
| 121 | return freq_next; |
| 122 | } |
| 123 | |
| 124 | cpufreq_frequency_table_target(policy, dbs_info->freq_table, freq_next, |
| 125 | relation, &index); |
| 126 | freq_req = dbs_info->freq_table[index].frequency; |
| 127 | freq_reduc = freq_req * dbs_tuners_ins.powersave_bias / 1000; |
| 128 | freq_avg = freq_req - freq_reduc; |
| 129 | |
| 130 | /* Find freq bounds for freq_avg in freq_table */ |
| 131 | index = 0; |
| 132 | cpufreq_frequency_table_target(policy, dbs_info->freq_table, freq_avg, |
| 133 | CPUFREQ_RELATION_H, &index); |
| 134 | freq_lo = dbs_info->freq_table[index].frequency; |
| 135 | index = 0; |
| 136 | cpufreq_frequency_table_target(policy, dbs_info->freq_table, freq_avg, |
| 137 | CPUFREQ_RELATION_L, &index); |
| 138 | freq_hi = dbs_info->freq_table[index].frequency; |
| 139 | |
| 140 | /* Find out how long we have to be in hi and lo freqs */ |
| 141 | if (freq_hi == freq_lo) { |
| 142 | dbs_info->freq_lo = 0; |
| 143 | dbs_info->freq_lo_jiffies = 0; |
| 144 | return freq_lo; |
| 145 | } |
| 146 | jiffies_total = usecs_to_jiffies(dbs_tuners_ins.sampling_rate); |
| 147 | jiffies_hi = (freq_avg - freq_lo) * jiffies_total; |
| 148 | jiffies_hi += ((freq_hi - freq_lo) / 2); |
| 149 | jiffies_hi /= (freq_hi - freq_lo); |
| 150 | jiffies_lo = jiffies_total - jiffies_hi; |
| 151 | dbs_info->freq_lo = freq_lo; |
| 152 | dbs_info->freq_lo_jiffies = jiffies_lo; |
| 153 | dbs_info->freq_hi_jiffies = jiffies_hi; |
| 154 | return freq_hi; |
| 155 | } |
| 156 | |
| 157 | static void ondemand_powersave_bias_init(void) |
| 158 | { |
| 159 | int i; |
| 160 | for_each_online_cpu(i) { |
| 161 | struct cpu_dbs_info_s *dbs_info = &per_cpu(cpu_dbs_info, i); |
| 162 | dbs_info->freq_table = cpufreq_frequency_get_table(i); |
| 163 | dbs_info->freq_lo = 0; |
| 164 | } |
| 165 | } |
| 166 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 167 | /************************** sysfs interface ************************/ |
| 168 | static ssize_t show_sampling_rate_max(struct cpufreq_policy *policy, char *buf) |
| 169 | { |
| 170 | return sprintf (buf, "%u\n", MAX_SAMPLING_RATE); |
| 171 | } |
| 172 | |
| 173 | static ssize_t show_sampling_rate_min(struct cpufreq_policy *policy, char *buf) |
| 174 | { |
| 175 | return sprintf (buf, "%u\n", MIN_SAMPLING_RATE); |
| 176 | } |
| 177 | |
Dave Jones | 32ee8c3 | 2006-02-28 00:43:23 -0500 | [diff] [blame] | 178 | #define define_one_ro(_name) \ |
| 179 | static struct freq_attr _name = \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 180 | __ATTR(_name, 0444, show_##_name, NULL) |
| 181 | |
| 182 | define_one_ro(sampling_rate_max); |
| 183 | define_one_ro(sampling_rate_min); |
| 184 | |
| 185 | /* cpufreq_ondemand Governor Tunables */ |
| 186 | #define show_one(file_name, object) \ |
| 187 | static ssize_t show_##file_name \ |
| 188 | (struct cpufreq_policy *unused, char *buf) \ |
| 189 | { \ |
| 190 | return sprintf(buf, "%u\n", dbs_tuners_ins.object); \ |
| 191 | } |
| 192 | show_one(sampling_rate, sampling_rate); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 193 | show_one(up_threshold, up_threshold); |
Alexander Clouter | 001893c | 2005-12-01 01:09:25 -0800 | [diff] [blame] | 194 | show_one(ignore_nice_load, ignore_nice); |
Alexey Starikovskiy | 05ca035 | 2006-07-31 22:28:12 +0400 | [diff] [blame] | 195 | show_one(powersave_bias, powersave_bias); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 196 | |
Dave Jones | 32ee8c3 | 2006-02-28 00:43:23 -0500 | [diff] [blame] | 197 | static ssize_t store_sampling_rate(struct cpufreq_policy *unused, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 198 | const char *buf, size_t count) |
| 199 | { |
| 200 | unsigned int input; |
| 201 | int ret; |
Venkatesh Pallipadi | ffac80e | 2006-06-28 13:52:18 -0700 | [diff] [blame] | 202 | ret = sscanf(buf, "%u", &input); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 203 | |
akpm@osdl.org | 3fc54d3 | 2006-01-13 15:54:22 -0800 | [diff] [blame] | 204 | mutex_lock(&dbs_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 205 | if (ret != 1 || input > MAX_SAMPLING_RATE || input < MIN_SAMPLING_RATE) { |
akpm@osdl.org | 3fc54d3 | 2006-01-13 15:54:22 -0800 | [diff] [blame] | 206 | mutex_unlock(&dbs_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 207 | return -EINVAL; |
| 208 | } |
| 209 | |
| 210 | dbs_tuners_ins.sampling_rate = input; |
akpm@osdl.org | 3fc54d3 | 2006-01-13 15:54:22 -0800 | [diff] [blame] | 211 | mutex_unlock(&dbs_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | |
| 213 | return count; |
| 214 | } |
| 215 | |
Dave Jones | 32ee8c3 | 2006-02-28 00:43:23 -0500 | [diff] [blame] | 216 | static ssize_t store_up_threshold(struct cpufreq_policy *unused, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 217 | const char *buf, size_t count) |
| 218 | { |
| 219 | unsigned int input; |
| 220 | int ret; |
Venkatesh Pallipadi | ffac80e | 2006-06-28 13:52:18 -0700 | [diff] [blame] | 221 | ret = sscanf(buf, "%u", &input); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 222 | |
akpm@osdl.org | 3fc54d3 | 2006-01-13 15:54:22 -0800 | [diff] [blame] | 223 | mutex_lock(&dbs_mutex); |
Dave Jones | 32ee8c3 | 2006-02-28 00:43:23 -0500 | [diff] [blame] | 224 | if (ret != 1 || input > MAX_FREQUENCY_UP_THRESHOLD || |
Dave Jones | c29f140 | 2005-05-31 19:03:50 -0700 | [diff] [blame] | 225 | input < MIN_FREQUENCY_UP_THRESHOLD) { |
akpm@osdl.org | 3fc54d3 | 2006-01-13 15:54:22 -0800 | [diff] [blame] | 226 | mutex_unlock(&dbs_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 227 | return -EINVAL; |
| 228 | } |
| 229 | |
| 230 | dbs_tuners_ins.up_threshold = input; |
akpm@osdl.org | 3fc54d3 | 2006-01-13 15:54:22 -0800 | [diff] [blame] | 231 | mutex_unlock(&dbs_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 232 | |
| 233 | return count; |
| 234 | } |
| 235 | |
Alexander Clouter | 001893c | 2005-12-01 01:09:25 -0800 | [diff] [blame] | 236 | static ssize_t store_ignore_nice_load(struct cpufreq_policy *policy, |
Dave Jones | 3d5ee9e | 2005-05-31 19:03:47 -0700 | [diff] [blame] | 237 | const char *buf, size_t count) |
| 238 | { |
| 239 | unsigned int input; |
| 240 | int ret; |
| 241 | |
| 242 | unsigned int j; |
Dave Jones | 32ee8c3 | 2006-02-28 00:43:23 -0500 | [diff] [blame] | 243 | |
Venkatesh Pallipadi | ffac80e | 2006-06-28 13:52:18 -0700 | [diff] [blame] | 244 | ret = sscanf(buf, "%u", &input); |
Dave Jones | 3d5ee9e | 2005-05-31 19:03:47 -0700 | [diff] [blame] | 245 | if ( ret != 1 ) |
| 246 | return -EINVAL; |
| 247 | |
| 248 | if ( input > 1 ) |
| 249 | input = 1; |
Dave Jones | 32ee8c3 | 2006-02-28 00:43:23 -0500 | [diff] [blame] | 250 | |
akpm@osdl.org | 3fc54d3 | 2006-01-13 15:54:22 -0800 | [diff] [blame] | 251 | mutex_lock(&dbs_mutex); |
Dave Jones | 3d5ee9e | 2005-05-31 19:03:47 -0700 | [diff] [blame] | 252 | if ( input == dbs_tuners_ins.ignore_nice ) { /* nothing to do */ |
akpm@osdl.org | 3fc54d3 | 2006-01-13 15:54:22 -0800 | [diff] [blame] | 253 | mutex_unlock(&dbs_mutex); |
Dave Jones | 3d5ee9e | 2005-05-31 19:03:47 -0700 | [diff] [blame] | 254 | return count; |
| 255 | } |
| 256 | dbs_tuners_ins.ignore_nice = input; |
| 257 | |
Venkatesh Pallipadi | ccb2fe2 | 2006-06-28 13:49:52 -0700 | [diff] [blame] | 258 | /* we need to re-evaluate prev_cpu_idle */ |
Dave Jones | dac1c1a | 2005-05-31 19:03:49 -0700 | [diff] [blame] | 259 | for_each_online_cpu(j) { |
Venkatesh Pallipadi | ccb2fe2 | 2006-06-28 13:49:52 -0700 | [diff] [blame] | 260 | struct cpu_dbs_info_s *dbs_info; |
| 261 | dbs_info = &per_cpu(cpu_dbs_info, j); |
| 262 | dbs_info->prev_cpu_idle = get_cpu_idle_time(j); |
| 263 | dbs_info->prev_cpu_wall = get_jiffies_64(); |
Dave Jones | 3d5ee9e | 2005-05-31 19:03:47 -0700 | [diff] [blame] | 264 | } |
akpm@osdl.org | 3fc54d3 | 2006-01-13 15:54:22 -0800 | [diff] [blame] | 265 | mutex_unlock(&dbs_mutex); |
Dave Jones | 3d5ee9e | 2005-05-31 19:03:47 -0700 | [diff] [blame] | 266 | |
| 267 | return count; |
| 268 | } |
| 269 | |
Alexey Starikovskiy | 05ca035 | 2006-07-31 22:28:12 +0400 | [diff] [blame] | 270 | static ssize_t store_powersave_bias(struct cpufreq_policy *unused, |
| 271 | const char *buf, size_t count) |
| 272 | { |
| 273 | unsigned int input; |
| 274 | int ret; |
| 275 | ret = sscanf(buf, "%u", &input); |
| 276 | |
| 277 | if (ret != 1) |
| 278 | return -EINVAL; |
| 279 | |
| 280 | if (input > 1000) |
| 281 | input = 1000; |
| 282 | |
| 283 | mutex_lock(&dbs_mutex); |
| 284 | dbs_tuners_ins.powersave_bias = input; |
| 285 | ondemand_powersave_bias_init(); |
| 286 | mutex_unlock(&dbs_mutex); |
| 287 | |
| 288 | return count; |
| 289 | } |
| 290 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 291 | #define define_one_rw(_name) \ |
| 292 | static struct freq_attr _name = \ |
| 293 | __ATTR(_name, 0644, show_##_name, store_##_name) |
| 294 | |
| 295 | define_one_rw(sampling_rate); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 296 | define_one_rw(up_threshold); |
Alexander Clouter | 001893c | 2005-12-01 01:09:25 -0800 | [diff] [blame] | 297 | define_one_rw(ignore_nice_load); |
Alexey Starikovskiy | 05ca035 | 2006-07-31 22:28:12 +0400 | [diff] [blame] | 298 | define_one_rw(powersave_bias); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | |
| 300 | static struct attribute * dbs_attributes[] = { |
| 301 | &sampling_rate_max.attr, |
| 302 | &sampling_rate_min.attr, |
| 303 | &sampling_rate.attr, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 304 | &up_threshold.attr, |
Alexander Clouter | 001893c | 2005-12-01 01:09:25 -0800 | [diff] [blame] | 305 | &ignore_nice_load.attr, |
Alexey Starikovskiy | 05ca035 | 2006-07-31 22:28:12 +0400 | [diff] [blame] | 306 | &powersave_bias.attr, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 307 | NULL |
| 308 | }; |
| 309 | |
| 310 | static struct attribute_group dbs_attr_group = { |
| 311 | .attrs = dbs_attributes, |
| 312 | .name = "ondemand", |
| 313 | }; |
| 314 | |
| 315 | /************************** sysfs end ************************/ |
| 316 | |
Venkatesh Pallipadi | 2f8a835 | 2006-06-28 13:51:19 -0700 | [diff] [blame] | 317 | static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | { |
Venkatesh Pallipadi | ccb2fe2 | 2006-06-28 13:49:52 -0700 | [diff] [blame] | 319 | unsigned int idle_ticks, total_ticks; |
| 320 | unsigned int load; |
Venkatesh Pallipadi | ccb2fe2 | 2006-06-28 13:49:52 -0700 | [diff] [blame] | 321 | cputime64_t cur_jiffies; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | |
| 323 | struct cpufreq_policy *policy; |
| 324 | unsigned int j; |
| 325 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | if (!this_dbs_info->enable) |
| 327 | return; |
| 328 | |
Alexey Starikovskiy | 05ca035 | 2006-07-31 22:28:12 +0400 | [diff] [blame] | 329 | this_dbs_info->freq_lo = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 330 | policy = this_dbs_info->cur_policy; |
Venkatesh Pallipadi | ccb2fe2 | 2006-06-28 13:49:52 -0700 | [diff] [blame] | 331 | cur_jiffies = jiffies64_to_cputime64(get_jiffies_64()); |
| 332 | total_ticks = (unsigned int) cputime64_sub(cur_jiffies, |
| 333 | this_dbs_info->prev_cpu_wall); |
| 334 | this_dbs_info->prev_cpu_wall = cur_jiffies; |
Linus Torvalds | 2cd7cbd | 2006-07-23 12:05:00 -0700 | [diff] [blame] | 335 | if (!total_ticks) |
| 336 | return; |
Dave Jones | 32ee8c3 | 2006-02-28 00:43:23 -0500 | [diff] [blame] | 337 | /* |
Dave Jones | c29f140 | 2005-05-31 19:03:50 -0700 | [diff] [blame] | 338 | * Every sampling_rate, we check, if current idle time is less |
| 339 | * than 20% (default), then we try to increase frequency |
Venkatesh Pallipadi | ccb2fe2 | 2006-06-28 13:49:52 -0700 | [diff] [blame] | 340 | * Every sampling_rate, we look for a the lowest |
Dave Jones | c29f140 | 2005-05-31 19:03:50 -0700 | [diff] [blame] | 341 | * frequency which can sustain the load while keeping idle time over |
| 342 | * 30%. If such a frequency exist, we try to decrease to this frequency. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 343 | * |
Dave Jones | 32ee8c3 | 2006-02-28 00:43:23 -0500 | [diff] [blame] | 344 | * Any frequency increase takes it to the maximum frequency. |
| 345 | * Frequency reduction happens at minimum steps of |
| 346 | * 5% (default) of current frequency |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 347 | */ |
| 348 | |
Venkatesh Pallipadi | ccb2fe2 | 2006-06-28 13:49:52 -0700 | [diff] [blame] | 349 | /* Get Idle Time */ |
Dave Jones | 9c7d269 | 2005-05-31 19:03:49 -0700 | [diff] [blame] | 350 | idle_ticks = UINT_MAX; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 351 | for_each_cpu_mask(j, policy->cpus) { |
Venkatesh Pallipadi | ccb2fe2 | 2006-06-28 13:49:52 -0700 | [diff] [blame] | 352 | cputime64_t total_idle_ticks; |
| 353 | unsigned int tmp_idle_ticks; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 354 | struct cpu_dbs_info_s *j_dbs_info; |
| 355 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 356 | j_dbs_info = &per_cpu(cpu_dbs_info, j); |
Dave Jones | dac1c1a | 2005-05-31 19:03:49 -0700 | [diff] [blame] | 357 | total_idle_ticks = get_cpu_idle_time(j); |
Venkatesh Pallipadi | ccb2fe2 | 2006-06-28 13:49:52 -0700 | [diff] [blame] | 358 | tmp_idle_ticks = (unsigned int) cputime64_sub(total_idle_ticks, |
| 359 | j_dbs_info->prev_cpu_idle); |
| 360 | j_dbs_info->prev_cpu_idle = total_idle_ticks; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 361 | |
| 362 | if (tmp_idle_ticks < idle_ticks) |
| 363 | idle_ticks = tmp_idle_ticks; |
| 364 | } |
Venkatesh Pallipadi | ccb2fe2 | 2006-06-28 13:49:52 -0700 | [diff] [blame] | 365 | load = (100 * (total_ticks - idle_ticks)) / total_ticks; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 366 | |
Venkatesh Pallipadi | ccb2fe2 | 2006-06-28 13:49:52 -0700 | [diff] [blame] | 367 | /* Check for frequency increase */ |
| 368 | if (load > dbs_tuners_ins.up_threshold) { |
Dave Jones | c11420a | 2005-05-31 19:03:48 -0700 | [diff] [blame] | 369 | /* if we are already at full speed then break out early */ |
Alexey Starikovskiy | 05ca035 | 2006-07-31 22:28:12 +0400 | [diff] [blame] | 370 | if (!dbs_tuners_ins.powersave_bias) { |
| 371 | if (policy->cur == policy->max) |
| 372 | return; |
Dave Jones | 32ee8c3 | 2006-02-28 00:43:23 -0500 | [diff] [blame] | 373 | |
Alexey Starikovskiy | 05ca035 | 2006-07-31 22:28:12 +0400 | [diff] [blame] | 374 | __cpufreq_driver_target(policy, policy->max, |
| 375 | CPUFREQ_RELATION_H); |
| 376 | } else { |
| 377 | int freq = powersave_bias_target(policy, policy->max, |
| 378 | CPUFREQ_RELATION_H); |
| 379 | __cpufreq_driver_target(policy, freq, |
| 380 | CPUFREQ_RELATION_L); |
| 381 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 382 | return; |
| 383 | } |
| 384 | |
| 385 | /* Check for frequency decrease */ |
Dave Jones | c29f140 | 2005-05-31 19:03:50 -0700 | [diff] [blame] | 386 | /* if we cannot reduce the frequency anymore, break out early */ |
| 387 | if (policy->cur == policy->min) |
| 388 | return; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 389 | |
Dave Jones | c29f140 | 2005-05-31 19:03:50 -0700 | [diff] [blame] | 390 | /* |
| 391 | * The optimal frequency is the frequency that is the lowest that |
| 392 | * can support the current CPU usage without triggering the up |
| 393 | * policy. To be safe, we focus 10 points under the threshold. |
| 394 | */ |
Venkatesh Pallipadi | ccb2fe2 | 2006-06-28 13:49:52 -0700 | [diff] [blame] | 395 | if (load < (dbs_tuners_ins.up_threshold - 10)) { |
Alexey Starikovskiy | 05ca035 | 2006-07-31 22:28:12 +0400 | [diff] [blame] | 396 | unsigned int freq_next = (policy->cur * load) / |
Dave Jones | c29f140 | 2005-05-31 19:03:50 -0700 | [diff] [blame] | 397 | (dbs_tuners_ins.up_threshold - 10); |
Alexey Starikovskiy | 05ca035 | 2006-07-31 22:28:12 +0400 | [diff] [blame] | 398 | if (!dbs_tuners_ins.powersave_bias) { |
| 399 | __cpufreq_driver_target(policy, freq_next, |
| 400 | CPUFREQ_RELATION_L); |
| 401 | } else { |
| 402 | int freq = powersave_bias_target(policy, freq_next, |
| 403 | CPUFREQ_RELATION_L); |
| 404 | __cpufreq_driver_target(policy, freq, |
| 405 | CPUFREQ_RELATION_L); |
| 406 | } |
Venkatesh Pallipadi | ccb2fe2 | 2006-06-28 13:49:52 -0700 | [diff] [blame] | 407 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 408 | } |
| 409 | |
Alexey Starikovskiy | 05ca035 | 2006-07-31 22:28:12 +0400 | [diff] [blame] | 410 | /* Sampling types */ |
| 411 | enum {DBS_NORMAL_SAMPLE, DBS_SUB_SAMPLE}; |
| 412 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 413 | static void do_dbs_timer(void *data) |
Dave Jones | 32ee8c3 | 2006-02-28 00:43:23 -0500 | [diff] [blame] | 414 | { |
Venkatesh Pallipadi | 2f8a835 | 2006-06-28 13:51:19 -0700 | [diff] [blame] | 415 | unsigned int cpu = smp_processor_id(); |
| 416 | struct cpu_dbs_info_s *dbs_info = &per_cpu(cpu_dbs_info, cpu); |
Alexey Starikovskiy | 1ce28d6 | 2006-07-31 22:25:20 +0400 | [diff] [blame] | 417 | /* We want all CPUs to do sampling nearly on same jiffy */ |
| 418 | int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate); |
| 419 | delay -= jiffies % delay; |
Venkatesh Pallipadi | 2f8a835 | 2006-06-28 13:51:19 -0700 | [diff] [blame] | 420 | |
Linus Torvalds | 2cd7cbd | 2006-07-23 12:05:00 -0700 | [diff] [blame] | 421 | if (!dbs_info->enable) |
| 422 | return; |
Alexey Starikovskiy | 05ca035 | 2006-07-31 22:28:12 +0400 | [diff] [blame] | 423 | /* Common NORMAL_SAMPLE setup */ |
| 424 | INIT_WORK(&dbs_info->work, do_dbs_timer, (void *)DBS_NORMAL_SAMPLE); |
| 425 | if (!dbs_tuners_ins.powersave_bias || |
| 426 | (unsigned long) data == DBS_NORMAL_SAMPLE) { |
| 427 | lock_cpu_hotplug(); |
| 428 | dbs_check_cpu(dbs_info); |
| 429 | unlock_cpu_hotplug(); |
| 430 | if (dbs_info->freq_lo) { |
| 431 | /* Setup timer for SUB_SAMPLE */ |
| 432 | INIT_WORK(&dbs_info->work, do_dbs_timer, |
| 433 | (void *)DBS_SUB_SAMPLE); |
| 434 | delay = dbs_info->freq_hi_jiffies; |
| 435 | } |
| 436 | } else { |
| 437 | __cpufreq_driver_target(dbs_info->cur_policy, |
| 438 | dbs_info->freq_lo, |
| 439 | CPUFREQ_RELATION_H); |
| 440 | } |
Alexey Starikovskiy | 1ce28d6 | 2006-07-31 22:25:20 +0400 | [diff] [blame] | 441 | queue_delayed_work_on(cpu, kondemand_wq, &dbs_info->work, delay); |
Dave Jones | 32ee8c3 | 2006-02-28 00:43:23 -0500 | [diff] [blame] | 442 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 443 | |
Venkatesh Pallipadi | 2f8a835 | 2006-06-28 13:51:19 -0700 | [diff] [blame] | 444 | static inline void dbs_timer_init(unsigned int cpu) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 445 | { |
Venkatesh Pallipadi | 2f8a835 | 2006-06-28 13:51:19 -0700 | [diff] [blame] | 446 | struct cpu_dbs_info_s *dbs_info = &per_cpu(cpu_dbs_info, cpu); |
Alexey Starikovskiy | 1ce28d6 | 2006-07-31 22:25:20 +0400 | [diff] [blame] | 447 | /* We want all CPUs to do sampling nearly on same jiffy */ |
| 448 | int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate); |
| 449 | delay -= jiffies % delay; |
Venkatesh Pallipadi | 2f8a835 | 2006-06-28 13:51:19 -0700 | [diff] [blame] | 450 | |
Alexey Starikovskiy | 05ca035 | 2006-07-31 22:28:12 +0400 | [diff] [blame] | 451 | ondemand_powersave_bias_init(); |
Venkatesh Pallipadi | 2f8a835 | 2006-06-28 13:51:19 -0700 | [diff] [blame] | 452 | INIT_WORK(&dbs_info->work, do_dbs_timer, 0); |
Alexey Starikovskiy | 1ce28d6 | 2006-07-31 22:25:20 +0400 | [diff] [blame] | 453 | queue_delayed_work_on(cpu, kondemand_wq, &dbs_info->work, delay); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 454 | } |
| 455 | |
Linus Torvalds | 2cd7cbd | 2006-07-23 12:05:00 -0700 | [diff] [blame] | 456 | static inline void dbs_timer_exit(struct cpu_dbs_info_s *dbs_info) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 457 | { |
Linus Torvalds | 2cd7cbd | 2006-07-23 12:05:00 -0700 | [diff] [blame] | 458 | dbs_info->enable = 0; |
| 459 | cancel_delayed_work(&dbs_info->work); |
| 460 | flush_workqueue(kondemand_wq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 461 | } |
| 462 | |
| 463 | static int cpufreq_governor_dbs(struct cpufreq_policy *policy, |
| 464 | unsigned int event) |
| 465 | { |
| 466 | unsigned int cpu = policy->cpu; |
| 467 | struct cpu_dbs_info_s *this_dbs_info; |
| 468 | unsigned int j; |
| 469 | |
| 470 | this_dbs_info = &per_cpu(cpu_dbs_info, cpu); |
| 471 | |
| 472 | switch (event) { |
| 473 | case CPUFREQ_GOV_START: |
Venkatesh Pallipadi | ffac80e | 2006-06-28 13:52:18 -0700 | [diff] [blame] | 474 | if ((!cpu_online(cpu)) || (!policy->cur)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 475 | return -EINVAL; |
| 476 | |
| 477 | if (policy->cpuinfo.transition_latency > |
Eric Piel | ff8c288 | 2006-03-10 11:34:16 +0200 | [diff] [blame] | 478 | (TRANSITION_LATENCY_LIMIT * 1000)) { |
| 479 | printk(KERN_WARNING "ondemand governor failed to load " |
| 480 | "due to too long transition latency\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 481 | return -EINVAL; |
Eric Piel | ff8c288 | 2006-03-10 11:34:16 +0200 | [diff] [blame] | 482 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 483 | if (this_dbs_info->enable) /* Already enabled */ |
| 484 | break; |
Dave Jones | 32ee8c3 | 2006-02-28 00:43:23 -0500 | [diff] [blame] | 485 | |
akpm@osdl.org | 3fc54d3 | 2006-01-13 15:54:22 -0800 | [diff] [blame] | 486 | mutex_lock(&dbs_mutex); |
Venkatesh Pallipadi | 2f8a835 | 2006-06-28 13:51:19 -0700 | [diff] [blame] | 487 | dbs_enable++; |
| 488 | if (dbs_enable == 1) { |
| 489 | kondemand_wq = create_workqueue("kondemand"); |
| 490 | if (!kondemand_wq) { |
| 491 | printk(KERN_ERR "Creation of kondemand failed\n"); |
| 492 | dbs_enable--; |
| 493 | mutex_unlock(&dbs_mutex); |
| 494 | return -ENOSPC; |
| 495 | } |
| 496 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 497 | for_each_cpu_mask(j, policy->cpus) { |
| 498 | struct cpu_dbs_info_s *j_dbs_info; |
| 499 | j_dbs_info = &per_cpu(cpu_dbs_info, j); |
| 500 | j_dbs_info->cur_policy = policy; |
Dave Jones | 32ee8c3 | 2006-02-28 00:43:23 -0500 | [diff] [blame] | 501 | |
Venkatesh Pallipadi | ccb2fe2 | 2006-06-28 13:49:52 -0700 | [diff] [blame] | 502 | j_dbs_info->prev_cpu_idle = get_cpu_idle_time(j); |
| 503 | j_dbs_info->prev_cpu_wall = get_jiffies_64(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 504 | } |
| 505 | this_dbs_info->enable = 1; |
| 506 | sysfs_create_group(&policy->kobj, &dbs_attr_group); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 507 | /* |
| 508 | * Start the timerschedule work, when this governor |
| 509 | * is used for first time |
| 510 | */ |
| 511 | if (dbs_enable == 1) { |
| 512 | unsigned int latency; |
| 513 | /* policy latency is in nS. Convert it to uS first */ |
Dave Jones | df8b59b | 2005-09-20 12:39:35 -0700 | [diff] [blame] | 514 | latency = policy->cpuinfo.transition_latency / 1000; |
| 515 | if (latency == 0) |
| 516 | latency = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 517 | |
Dave Jones | df8b59b | 2005-09-20 12:39:35 -0700 | [diff] [blame] | 518 | def_sampling_rate = latency * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 519 | DEF_SAMPLING_RATE_LATENCY_MULTIPLIER; |
Dave Jones | df8b59b | 2005-09-20 12:39:35 -0700 | [diff] [blame] | 520 | |
| 521 | if (def_sampling_rate < MIN_STAT_SAMPLING_RATE) |
| 522 | def_sampling_rate = MIN_STAT_SAMPLING_RATE; |
| 523 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 524 | dbs_tuners_ins.sampling_rate = def_sampling_rate; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 525 | } |
Venkatesh Pallipadi | 2f8a835 | 2006-06-28 13:51:19 -0700 | [diff] [blame] | 526 | dbs_timer_init(policy->cpu); |
Dave Jones | 32ee8c3 | 2006-02-28 00:43:23 -0500 | [diff] [blame] | 527 | |
akpm@osdl.org | 3fc54d3 | 2006-01-13 15:54:22 -0800 | [diff] [blame] | 528 | mutex_unlock(&dbs_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 529 | break; |
| 530 | |
| 531 | case CPUFREQ_GOV_STOP: |
akpm@osdl.org | 3fc54d3 | 2006-01-13 15:54:22 -0800 | [diff] [blame] | 532 | mutex_lock(&dbs_mutex); |
Linus Torvalds | 2cd7cbd | 2006-07-23 12:05:00 -0700 | [diff] [blame] | 533 | dbs_timer_exit(this_dbs_info); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 534 | sysfs_remove_group(&policy->kobj, &dbs_attr_group); |
| 535 | dbs_enable--; |
Dave Jones | 32ee8c3 | 2006-02-28 00:43:23 -0500 | [diff] [blame] | 536 | if (dbs_enable == 0) |
Venkatesh Pallipadi | 2f8a835 | 2006-06-28 13:51:19 -0700 | [diff] [blame] | 537 | destroy_workqueue(kondemand_wq); |
Dave Jones | 32ee8c3 | 2006-02-28 00:43:23 -0500 | [diff] [blame] | 538 | |
akpm@osdl.org | 3fc54d3 | 2006-01-13 15:54:22 -0800 | [diff] [blame] | 539 | mutex_unlock(&dbs_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 540 | |
| 541 | break; |
| 542 | |
| 543 | case CPUFREQ_GOV_LIMITS: |
akpm@osdl.org | 3fc54d3 | 2006-01-13 15:54:22 -0800 | [diff] [blame] | 544 | mutex_lock(&dbs_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 545 | if (policy->max < this_dbs_info->cur_policy->cur) |
Venkatesh Pallipadi | ffac80e | 2006-06-28 13:52:18 -0700 | [diff] [blame] | 546 | __cpufreq_driver_target(this_dbs_info->cur_policy, |
| 547 | policy->max, |
| 548 | CPUFREQ_RELATION_H); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 549 | else if (policy->min > this_dbs_info->cur_policy->cur) |
Venkatesh Pallipadi | ffac80e | 2006-06-28 13:52:18 -0700 | [diff] [blame] | 550 | __cpufreq_driver_target(this_dbs_info->cur_policy, |
| 551 | policy->min, |
| 552 | CPUFREQ_RELATION_L); |
akpm@osdl.org | 3fc54d3 | 2006-01-13 15:54:22 -0800 | [diff] [blame] | 553 | mutex_unlock(&dbs_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 554 | break; |
| 555 | } |
| 556 | return 0; |
| 557 | } |
| 558 | |
Dave Jones | 7f335d4 | 2005-05-31 19:03:46 -0700 | [diff] [blame] | 559 | static struct cpufreq_governor cpufreq_gov_dbs = { |
Venkatesh Pallipadi | ffac80e | 2006-06-28 13:52:18 -0700 | [diff] [blame] | 560 | .name = "ondemand", |
| 561 | .governor = cpufreq_governor_dbs, |
| 562 | .owner = THIS_MODULE, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 563 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 564 | |
| 565 | static int __init cpufreq_gov_dbs_init(void) |
| 566 | { |
| 567 | return cpufreq_register_governor(&cpufreq_gov_dbs); |
| 568 | } |
| 569 | |
| 570 | static void __exit cpufreq_gov_dbs_exit(void) |
| 571 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 572 | cpufreq_unregister_governor(&cpufreq_gov_dbs); |
| 573 | } |
| 574 | |
| 575 | |
Venkatesh Pallipadi | ffac80e | 2006-06-28 13:52:18 -0700 | [diff] [blame] | 576 | MODULE_AUTHOR("Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>"); |
| 577 | MODULE_AUTHOR("Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>"); |
| 578 | MODULE_DESCRIPTION("'cpufreq_ondemand' - A dynamic cpufreq governor for " |
| 579 | "Low Latency Frequency Transition capable processors"); |
| 580 | MODULE_LICENSE("GPL"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 581 | |
| 582 | module_init(cpufreq_gov_dbs_init); |
| 583 | module_exit(cpufreq_gov_dbs_exit); |