The linux documentation of the variable sysfs scaling_max_freq reports

Maximum frequency the CPUs belonging to this policy are allowed to be running at (in kHz).

This attribute is read-write and writing a string representing an integer to it will cause a new limit to be set (it must not be lower than the value of the scaling_min_freq attribute).

My perception of the above was that I can use the following command

$ echo 2133000 >/sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq

to indicate to the cpufreq governer that I desire cpu0 to be run at maximum 2133Mhz. After having set the value I can check it being set via

$ cat /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq

which indeed yields 2133000

Now here comes the strange part, which prompts me to pose this question here:

During the executing of a cpu intensive task (e.g. a kernel build) I check the value in /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq and it reports 1199000, a much lower frequency.

Now I am puzzled: who did change the value? the cpufreq governer?

update/info to commends

  • dmesg does not show any throttling messages
  • make -j4 was used so to use 4 four pipelines of the intel cpu (model name : Intel(R) Core(TM) i5 CPU M 560 @ 2.67GHz)
  • uname -a shows Linux work 4.18.3-arch1-1-ARCH #1 SMP PREEMPT Sat Aug 18 09:22:54 UTC 2018 x86_64 GNU/Linux hence my arch linux stock kernel
  • cpufreq governer is schedutil
  • /sys/devices/system/cpu/cpufreq/policy0/scaling_driver shows acpi-cpufreq

  • /sys/devices/system/cpu/cpu0/cpufreq/bios_limit tells 2666000 which as I would expect the max freq of the cpu. (Should I check this value during cpu stress, or in idle??)

The laptop is a Lenovo Thinkpad X201t (tablet) model, whith the mains adapter being the original one supplied to the model at purchase. However I have temporarily switched the mains power supply adapter with another one and will report results.

To be absolutely clear. The value of scaling_max_freq is restored after the high cpu load task has ended. In "almost idle" state it again tells me the 2133000 originally set.

  • obvious question: did you remember to run your kernel build multi-threaded? I.e. make -j 4 (or maybe more) if your system has 4 logical cpus? And, did you measure at a point where there were 4 processes? IIRC the final linking step is single-threaded. – sourcejedi Aug 23 '18 at 18:35
  • @sourcejedi thanks for enhancing the question with the pointers to required information (i was at a loss what to provide here). I edit the question with the information. With regards to the multi-threadedness I can say that the effect of suddenly having a lower value reported in scaling_max_freq was during the compile phase (not the linking phase). Anyway I would never expect the scaling_max_freq to be changed, if the freq changes I thought that to be exclusively in /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq. But as it seems the value is temporarily changed. – humanityANDpeace Aug 23 '18 at 18:46
  • The intel_pstate documentation suggests that scaling_max_freq is capped to the current P-state; your CPU is using acpi-cpufreq (Arrandale is too old for intel_pstate), so that doesn’t apply directly, but I imagine a similar mechanism could be involved here (if I’m reading the code correctly, the kernel updates scaling_max_freq on power-state changes). It’s not unusual for mobile CPUs to throttle down to much lower frequencies than their nominal frequency under load. – Stephen Kitt Aug 23 '18 at 19:01
  • turns out laptop firmware is extremely weird, please report your laptop brand, model, age, and if your mains adaptor was new along with the laptop or is a replacement ubuntuforums.org/… – sourcejedi Aug 23 '18 at 19:26
  • google says also check cat /sys/devices/system/cpu/cpu0/cpufreq/bios_limit. If your issue was due to the bios detecting some issue with the mains adaptor, I would really expect bios_limit would show as the limiting factor. – sourcejedi Aug 23 '18 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.