Comment 0 for bug 1889479

Revision history for this message
Matthieu Baerts (matttbe) wrote :

Hello,

TL;DR the default cpufreq governor is now "performance" instead of "powersave" since ondemand service is no longer shipped with systemd.

First, thank you for maintaining systemd in Ubuntu?

I am using Ubuntu Devel on my daily laptop. For a few weeks now, I noticed the fans of my laptop were more regularly active and running at a higher speed. I took some time to investigate the issue, suspecting some apps using more resources or dust causing issues.

But it started to annoy me and I noticed CPU frequencies were often high: >3.5GHz while not doing intensive use, e.g. having a terminal, note app, chat, a browser with a few active tabs for email, calendar, etc. but no video, etc. I didn't change what I am usually doing with my laptop and I am connected to a remote server via SSH for dev tasks.
Also, the temperature of the CPU cores were often around 70°C or more according to s-tui and sensors.

== Investigation ==

My CPU: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz

When investigating the issue, I saw the CPU frequencies were often high, I looked at the cpufreq governor and it was set to performance:

  $ cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor | sort -u
  performance

Setting it to "powersave" helped to reduce the CPU freq from ~3.5GHz to ~2.4GHz when using the laptop with the battery:

  # cpupower frequency-set --governor powersave
  (...)
  # cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor | sort -u
  powersave

Reducing also the temperature by the same occasion.

With TLP, the CPU freq are now around 800MHz when using the battery while still being quite reactive and increasing when needed. I understand it's certainly something many people would not like to have by default. But it is interesting to try for those who want to reduce

Increasing the CPU consumptions has of course an impact on the energy but also the comfort because of the noise of the fans can do when running at high speed and the time you can use your device on battery. But also and because of the higher temperature, the battery and other components could have issues and the CPU clock is regularly throttled while not doing much:

  (...)
  [39948.392090] mce: CPU4: Package temperature above threshold, cpu clock throttled (total events = 45107)
  [39948.392091] mce: CPU0: Package temperature above threshold, cpu clock throttled (total events = 45107)
  [39948.392127] mce: CPU5: Package temperature above threshold, cpu clock throttled (total events = 45107)
  [39948.392128] mce: CPU1: Package temperature above threshold, cpu clock throttled (total events = 45107)
  [39948.392129] mce: CPU6: Package temperature above threshold, cpu clock throttled (total events = 45107)
  [39948.392130] mce: CPU2: Package temperature above threshold, cpu clock throttled (total events = 45107)
  [39948.392131] mce: CPU3: Package temperature above threshold, cpu clock throttled (total events = 45107)
  [39948.392132] mce: CPU7: Package temperature above threshold, cpu clock throttled (total events = 45107)
  ## there are a lot more
  (...)

Regarding the throttle, it was better after having applied: https://github.com/erpalma/throttled
But at the end, the temperature was increasing even more: around 80°C when charging the battery and when doing a bit more activities (e.g. webrtc conf call).

== Bisect ==

I tried to understand if it is normal to have "performance" by default. The kernel config didn't change recently (CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y) but then I found this: https://salsa.debian.org/systemd-team/systemd/-/commit/65f46a7d14b335e5743350dbbc5b5ef1e72826f7

It looks like "ondemand" service is no longer shipped with systemd. According to Dan, it is not needed and not used by other distributions. But then I wonder if other distributions are maybe applying other kernel config not to use the full power as quickly as it was in my case. For example, do they also have CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y?

On Fedora, for the kernel 5.7, I see ONDEMAND is used by default: https://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git/tree/fedora/configs/kernel-5.7.11-x86_64.config?h=f32&id=b192daedbdefafedac87d825df77ea92d3f4c697#n589

In conclusion, is it a good idea to have "performance" as default cpufreq governor on a desktop? (or others)