Commit 4f4d1ad6ee69027f51f9d137f7e7d3c863cbc53d

Authored by Thomas Renninger
Committed by Dave Jones
1 parent 86e13684aa

[CPUFREQ] Only set sampling_rate_max deprecated, sampling_rate_min is useful

Update the documentation accordingly.
Cleanup and use printk_once.

Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Dave Jones <davej@redhat.com>

Showing 3 changed files with 18 additions and 43 deletions Side-by-side Diff

Documentation/cpu-freq/governors.txt
... ... @@ -119,10 +119,6 @@
119 119 what to do about the frequency. Typically this is set to values of
120 120 around '10000' or more. It's default value is (cmp. with users-guide.txt):
121 121 transition_latency * 1000
122   -The lowest value you can set is:
123   -transition_latency * 100 or it may get restricted to a value where it
124   -makes not sense for the kernel anymore to poll that often which depends
125   -on your HZ config variable (HZ=1000: max=20000us, HZ=250: max=5000).
126 122 Be aware that transition latency is in ns and sampling_rate is in us, so you
127 123 get the same sysfs value by default.
128 124 Sampling rate should always get adjusted considering the transition latency
... ... @@ -131,14 +127,20 @@
131 127 echo `$(($(cat cpuinfo_transition_latency) * 750 / 1000)) \
132 128 >ondemand/sampling_rate
133 129  
134   -show_sampling_rate_(min|max): THIS INTERFACE IS DEPRECATED, DON'T USE IT.
135   -You can use wider ranges now and the general
136   -cpuinfo_transition_latency variable (cmp. with user-guide.txt) can be
137   -used to obtain exactly the same info:
138   -show_sampling_rate_min = transtition_latency * 500 / 1000
139   -show_sampling_rate_max = transtition_latency * 500000 / 1000
140   -(divided by 1000 is to illustrate that sampling rate is in us and
141   -transition latency is exported ns).
  130 +show_sampling_rate_min:
  131 +The sampling rate is limited by the HW transition latency:
  132 +transition_latency * 100
  133 +Or by kernel restrictions:
  134 +If CONFIG_NO_HZ is set, the limit is 10ms fixed.
  135 +If CONFIG_NO_HZ is not set or no_hz=off boot parameter is used, the
  136 +limits depend on the CONFIG_HZ option:
  137 +HZ=1000: min=20000us (20ms)
  138 +HZ=250: min=80000us (80ms)
  139 +HZ=100: min=200000us (200ms)
  140 +The highest value of kernel and HW latency restrictions is shown and
  141 +used as the minimum sampling rate.
  142 +
  143 +show_sampling_rate_max: THIS INTERFACE IS DEPRECATED, DON'T USE IT.
142 144  
143 145 up_threshold: defines what the average CPU usage between the samplings
144 146 of 'sampling_rate' needs to be for the kernel to make a decision on
drivers/cpufreq/cpufreq_conservative.c
... ... @@ -167,26 +167,13 @@
167 167 /************************** sysfs interface ************************/
168 168 static ssize_t show_sampling_rate_max(struct cpufreq_policy *policy, char *buf)
169 169 {
170   - static int print_once;
171   -
172   - if (!print_once) {
173   - printk(KERN_INFO "CPUFREQ: conservative sampling_rate_max "
174   - "sysfs file is deprecated - used by: %s\n",
175   - current->comm);
176   - print_once = 1;
177   - }
  170 + printk_once(KERN_INFO "CPUFREQ: conservative sampling_rate_max "
  171 + "sysfs file is deprecated - used by: %s\n", current->comm);
178 172 return sprintf(buf, "%u\n", -1U);
179 173 }
180 174  
181 175 static ssize_t show_sampling_rate_min(struct cpufreq_policy *policy, char *buf)
182 176 {
183   - static int print_once;
184   -
185   - if (!print_once) {
186   - printk(KERN_INFO "CPUFREQ: conservative sampling_rate_max "
187   - "sysfs file is deprecated - used by: %s\n", current->comm);
188   - print_once = 1;
189   - }
190 177 return sprintf(buf, "%u\n", min_sampling_rate);
191 178 }
192 179  
drivers/cpufreq/cpufreq_ondemand.c
... ... @@ -205,27 +205,13 @@
205 205 /************************** sysfs interface ************************/
206 206 static ssize_t show_sampling_rate_max(struct cpufreq_policy *policy, char *buf)
207 207 {
208   - static int print_once;
209   -
210   - if (!print_once) {
211   - printk(KERN_INFO "CPUFREQ: ondemand sampling_rate_max "
212   - "sysfs file is deprecated - used by: %s\n",
213   - current->comm);
214   - print_once = 1;
215   - }
  208 + printk_once(KERN_INFO "CPUFREQ: ondemand sampling_rate_max "
  209 + "sysfs file is deprecated - used by: %s\n", current->comm);
216 210 return sprintf(buf, "%u\n", -1U);
217 211 }
218 212  
219 213 static ssize_t show_sampling_rate_min(struct cpufreq_policy *policy, char *buf)
220 214 {
221   - static int print_once;
222   -
223   - if (!print_once) {
224   - printk(KERN_INFO "CPUFREQ: ondemand sampling_rate_min "
225   - "sysfs file is deprecated - used by: %s\n",
226   - current->comm);
227   - print_once = 1;
228   - }
229 215 return sprintf(buf, "%u\n", min_sampling_rate);
230 216 }
231 217