[groovy] "performance" cpufreq governor has a big impact on CPU consumption

Bug #1889479 reported by Matthieu Baerts
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
New
Undecided
Unassigned
Groovy
New
Undecided
Unassigned

Bug Description

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 (Dell XPS 13 9730). 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. In total the resources the CPU usage was around 50 to 100 out of 800%. I didn't really change what I am usually doing with my laptop compared to a few months ago -- I even enabled more hardware accelerations working pretty well -- 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 for the same utilisation 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.

After that I tried TLP. I didn't really need it in the past but I wanted to see the new behaviour. The CPU freq are now around 800MHz when using the battery doing the same as before 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. Of course, because of the higher temperature, the battery and other components are more likely to run into 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: more than 80°C when charging the battery and when doing a bit more activities (e.g. webrtc conf call) but still the CPU was used at ~¼ according to htop. I decided to check why the behaviour changed.

== 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

I didn't check other distributions so far.

In conclusion, is it a good idea to have "performance" as default cpufreq governor? At least on a desktop or any other devices not running at the full power most of the time or not requiring very high reactivity?

description: updated
Revision history for this message
Dan Streetman (ddstreet) wrote :

Thanks - I believe this is a duplicate of bug 1885730

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

Hi Dan,

Oh yes indeed, sorry I looked for issues in systemd and I missed it!

I'm fine with the "duplicate" status.

Cheers,
Matt

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.