ValveSoftware / SteamOS

SteamOS community tracker
1.59k stars 70 forks source link

Please increase the Linux kernel tick-rate from 300 Hz to 1000 Hz in order to both increase responsiveness & reduce energy consumption, similar to Ubuntu 24.04 LTS #1522

Open FanOfABT opened 5 months ago

FanOfABT commented 5 months ago

Your system information

Please describe your issue in as much detail as possible:

An excellent article about tweaking SteamOS by A.B.T. has included a request for Valve to increase the Linux kernel tick-rate from 300 Hz to 1000 Hz in order to reduce the overall system latency, as you can see here:

https://medium.com/@a.b.t./here-are-some-possibly-useful-tweaks-for-steamos-on-the-steam-deck-fcb6b571b577#1328

I checked that this is indeed still the case by running the following command on my Steam Deck:

cat /proc/config.gz | gunzip | grep 'CONFIG_HZ='

The result was CONFIG_HZ=300, as written by A.B.T.

When researching about this, I learned that Ubuntu has also changed to the 1000 Hz tick-rate option for Ubuntu 24.04 LTS, as can be seen here:

https://discourse.ubuntu.com/t/enable-low-latency-features-in-the-generic-ubuntu-kernel-for-24-04/42255

The real surprise for me was the fact that besides improving system responsiveness by reducing overall latency, the 1000 Hz option in fact reduced energy/power consumption on a busy system, too!

Here are the relevant numbers:

Idle system

Busy system

Of course, please feel free to independently verify these results by doing your own testing on SteamOS.

From the looks of it, setting the 1000 Hz kernel option could be a win-win situation for the Steam Deck, since it both reduces the latency and battery usage at the same time!

Hopefully you guys at Valve could do some experimenting of your own and possibly set the 1000 Hz option to be the default, so that all Steam Deck users could stand to profit from this...

Many thanks in advance!

Steps for reproducing this issue:

  1. Open the Konsole terminal
  2. Copy & paste: cat /proc/config.gz | gunzip | grep 'CONFIG_HZ='
  3. Check whether it reads CONFIG_HZ=300 or CONFIG_HZ=1000
SebKoehlerLemonbeat commented 5 months ago

Ist there a way to set this by hand without the need to compile the kernel?

micsama commented 5 months ago

Ist there a way to set this by hand without the need to compile the kernel?

FanOfABT commented 4 months ago

@lostgoat @kisak-valve

Sorry for bothering you guys, but are there any plans to switch over to the 1000 Hz Linux kernel tick-rate for the upcoming SteamOS 3.6 release?

I'm asking because there are reports of people seeing some good improvements with Ubuntu 24.04 LTS, which switched over to the 1000 Hz tick-rate by default.

Here are two quotes in particular:

1. As you can see from "Fine-Tuning the Ubuntu 24.04 Kernel for low latency, throughput, and power efficiency", there were some improvements to the kernel this cycle which you might be seeing form a gaming perspective. I, too, have seen much improved performance in this arena from both a gaming and audio engineering perspective.

2. About power consumption, one interesting result that I have found after switching from CONFIG_HZ=250 to CONFIG_HZ=1000 in 24.04 was a noticeable reduction in power consumption across different workloads. CONFIG_HZ determines how many times per second the system tick runs (used as a periodic source of interrupt for scheduling purposes and perform periodic kernel jobs). It seems counter-intuitive that increasing the frequency can reduce power consumption, but apparently it seems that having more interruptions help to give more chances to the CPUs to go idle faster. Considering that entering idle state (and remaining in idle state as much as possible) is the most effective way nowdays to reduce CPU power consumption, this explains the reduced power with the increased CONFIG_HZ.

So it really looks like setting the Linux kernel tick-rate to 1000 Hz by default can result in noticable improvements across the board, as suggested by A.B.T. and proven by Ubuntu.

Hopefully Valve also considers doing the same on SteamOS, so that all users can benefit from similar improvements on the Steam Deck.

Thanks in advance!

MCPtz commented 4 months ago

As a professional software engineer in Silicon Valley who works on embedded systems and sometimes in the kernel, I strongly support this change.

Verification will take a bit of time, but please add it to the next release cycle / preview releases.

LexpertMan commented 4 months ago

@kisak-valve

Is there any particular reason why Valve hasn't made the 1000 Hz kernel tick-rate the default by now?

I honestly was suprised to find out that Valve went with the 300 Hz option, because 1000 Hz has been the default on RHEL for as long as I can remember.

And as the above data shows, for very good reasons.

So, could we please get an update on the situation from Valve?

Regards

jams3223 commented 3 months ago

Let's get it done Valve.

YoreonX commented 3 months ago

I'm all for it.

Will reduce System Power Usage for all Systems.

And will allow OLED users noticeable improvements in response times.

RandomLinuxGuru commented 3 months ago

@YoreonX

I'm curious, why do you believe this change would improve response times for OLED users only?

My understanding is that all SteamOS users would benefit from this equally, no matter the model of Steam Deck.

@kisak-valve

Could you please provide us with an update on this?

In case Valve needs any more confirmation that this change is universally beneficial:

Recently I installed Bazzite OS on my 256 GB LCD model Steam Deck, which ships with A.B.T.'s SteamOS tweaks pre-applied, including a Linux kernel with a 1000 Hz tick-rate, and the performance I'm getting on demanding games like Halo Infinite is noticeably better than on my Steam Deck OLED running stock SteamOS 3.6 BETA.

The fact that an unofficial Linux distro is able to achieve better performance than Valve's own SteamOS is something you guys should look into, IMHO.

Really hope you or anyone else from Valve can provide us an update on the situation, because switching the Linux kernel to a 1000 Hz tick-rate is a no-brainer that should have been the default ever since the launch of the Steam Deck.

Thanks!

RickS-C137 commented 2 months ago

@RandomLinuxGuru Parts of A.B.T.s tweaks already have been added to SteamOS a while ago.

Apart from that, I checked the tick rate of my Bazzite installation with getconf CLK_TCK and it's set to 100, not 1000.

FanOfABT commented 2 months ago

@RickS-C137

Please note that CLK_TCK always shows 100 Hz.

To get the correct answer, one has to look at the config file the Linux kernel was built with.

I just asked in Bazzite's official forum to get the correct answer:

https://universal-blue.discourse.group/t/could-you-please-verify-that-the-linux-kernel-of-bazzite-is-still-configured-with-a-1000-hz-tick-rate/3501

EDIT:

A friendly user on Reddit just confirmed that Bazzite does indeed default to a 1000 Hz Linux kernel tick-rate:

cat /usr/lib/modules/$(uname -r)/config | grep 'CONFIG_HZ=' works and shows 1000Hz.

mario-aleo commented 1 month ago

@RandomLinuxGuru Parts of A.B.T.s tweaks already have been added to SteamOS a while ago.

Apart from that, I checked the tick rate of my Bazzite installation with getconf CLK_TCK and it's set to 100, not 1000.

Do you know which ones? I'm curious about it.