Lines Matching refs:the

1      CPU frequency and voltage scaling code in the Linux(TM) kernel
16 Clock scaling allows you to change the clock speed of the CPUs on the
17 fly. This is a nice method to save battery power, because the lower
18 the clock speed, the less power the CPU consumes.
25 2. Governors In the Linux Kernel
32 3. The Governor Interface in the CPUfreq Core
39 Most cpufreq drivers (except the intel_pstate and longrun) or even most
40 cpu frequency scaling algorithms only offer the CPU to be set to one
41 frequency. In order to offer dynamic frequency scaling, the cpufreq
44 call instead of the existing "->setpolicy" call. For "longrun", all
45 stays the same, though.
47 How to decide what frequency within the CPUfreq policy should be used?
49 -- they're the already existing "powersave" and "performance" which
50 set the frequency statically to the lowest or highest frequency,
52 addition in the near future, but likely many more as there are various
55 governors, these can be tested extensively, and the best one can be
58 Basically, it's the following flow graph:
68 / the cpufreq governor decides
71 / the limits of policy->{min,max}
74 Using the ->setpolicy call, Using the ->target/target_index call,
75 the limits and the the frequency closest
81 2. Governors In the Linux Kernel
87 The CPUfreq governor "performance" sets the CPU statically to the
88 highest frequency within the borders of scaling_min_freq and
95 The CPUfreq governor "powersave" sets the CPU statically to the
96 lowest frequency within the borders of scaling_min_freq and
103 The CPUfreq governor "userspace" allows the user, or any userspace
104 program running with UID "root", to set the CPU to a specific frequency
105 by making a sysfs file "scaling_setspeed" available in the CPU-device
112 The CPUfreq governor "ondemand" sets the CPU depending on the
113 current usage. To do this the CPU must have the capability to
114 switch the frequency very quickly. There are a number of sysfs file
118 want the kernel to look at the CPU usage and to make decisions on
119 what to do about the frequency. Typically this is set to values of
123 get the same sysfs value by default.
124 Sampling rate should always get adjusted considering the transition latency
125 To set the sampling rate 750 times as high as the transition latency
126 in the bash (as said, 1000 is default), do:
131 The sampling rate is limited by the HW transition latency:
134 If CONFIG_NO_HZ_COMMON is set, the limit is 10ms fixed.
135 If CONFIG_NO_HZ_COMMON is not set or nohz=off boot parameter is used, the
136 limits depend on the CONFIG_HZ option:
141 used as the minimum sampling rate.
143 up_threshold: defines what the average CPU usage between the samplings
144 of 'sampling_rate' needs to be for the kernel to make a decision on
145 whether it should increase the frequency. For example when it is set
146 to its default value of '95' it means that between the checking
147 intervals the CPU needs to be on average more than 95% in use to then
148 decide that the CPU frequency needs to be increased.
151 set to '0' (its default), all processes are counted towards the
152 'cpu utilisation' value. When set to '1', the processes that are
153 run with a 'nice' value will not count (and thus be ignored) in the
157 in the deciding process of whether to increase your CPU frequency.
159 sampling_down_factor: this parameter controls the rate at which the
160 kernel makes a decision on when to decrease the frequency while running
161 at top speed. When set to 1 (the default) decisions to reevaluate load
162 are made at the same interval regardless of current clock speed. But
163 when set to greater than 1 (e.g. 100) it acts as a multiplier for the
164 scheduling interval for reevaluating load when the CPU is at its top
165 speed due to high load. This improves performance by reducing the overhead
166 of load evaluation and helping the CPU stay at its top speed when truly
171 defines the percentage (times 10) value of the target frequency that
172 will be shaved off of the target. For example, when set to 100 -- 10%,
178 defines the workload frequency sensitivity threshold in which a lower
182 the performance of the workload running on a CPU will change when
186 higher the frequency. When the driver is loaded, this is set to 400
188 40%, a lower frequency is chosen. Unloading the driver or writing 0
195 The CPUfreq governor "conservative", much like the "ondemand"
196 governor, sets the CPU depending on the current usage. It differs in
197 behaviour in that it gracefully increases and decreases the CPU speed
198 rather than jumping to max speed the moment there is any load on the
200 The governor is tweaked in the same manner as the "ondemand" governor
201 through sysfs with the addition of:
203 freq_step: this describes what percentage steps the cpu freq should be
204 increased and decreased smoothly by. By default the cpu frequency will
208 it behave identically to the "ondemand" governor.
210 down_threshold: same as the 'up_threshold' found for the "ondemand"
211 governor but for the opposite direction. For example when set to its
212 default value of '20' it means that if the CPU usage needs to be below
213 20% between samples to have the frequency decreased.
216 But in "conservative", it controls the rate at which the kernel makes
217 a decision on when to decrease the frequency while running in any
221 3. The Governor Interface in the CPUfreq Core
224 A new governor must register itself with the CPUfreq core using
226 be passed to that function, must contain the following values:
230 governor->owner - .THIS_MODULE for the governor module (if
233 The governor->governor callback is called with the current (or to-be-set)
237 CPUFREQ_GOV_START: This governor shall start its duty for the CPU
239 CPUFREQ_GOV_STOP: This governor shall end its duty for the CPU
244 If you need other "events" externally of your driver, _only_ use the
245 cpufreq_governor_l(unsigned int cpu, unsigned int event) call to the
249 The CPUfreq governor may call the CPU processor driver using one of
261 What's the difference between these two functions? When your governor
262 still is in a direct code path of a call to governor->governor, the
263 per-CPU cpufreq lock is still held in the cpufreq core, and there's
267 every second), use cpufreq_driver_target to lock the cpufreq per-CPU
268 lock before the command is passed to the cpufreq processor driver.