r/linux_gaming • u/WhitePeace36 • Oct 02 '26
guide Updated Linux gaming optimizations guide
Hi guys,
its been quite a while since i posted the gaming optimizations guide i wrote.
Since the last time there has been quite a lot of changes.
https://github.com/WhitePeace36/LinuxAMDGamingOptimizationGuide
Even though it says AMD, most of it is for linux in general.
I hope this updated version helps at least a few of you out there which try to have a better gaming experience.
148
u/theevilsharpie Oct 02 '26 edited Oct 02 '26
Wake up babe, a new "gamer tweak guide" just dropped!
So, what's wrong with this one?
Bios Settings
Amd fTPM - DisableThere has been some bugs where this caused some stutters, but i don't know if this is fixed already. Better to turn it off.
Don't do this.
This was a very specific issue that I don't ever practically impacted anything other than Windows, and should have been resolved years ago with a BIOS update.
If you had posted this guide several years ago, I probably would have responded with "meh, whatever." However, more modern games are making use of the TPM for anti-cheat (if not within Linux, then by Windows games that your audience might be playing via dual booting), and Linux distributions are starting to support it for use with auto-unlocking full-disk encryption, so telling users "don't know -- better to turn it off" is quite irresponsible.
Don't disable your TPM unless you absolutely know for sure you don't need one.
XHCI Handoff - DISABLEThis setting should be somewhere in the usb settings. This can cause really nasty stutters in some games.
Don't do this.
This setting should be ENABLED or AUTO on any modern hardware (certainly anything new enough to support resizable BAR), and is almost certainly set that way by default. Modern Linux and Windows both natively support XHCI-based controllers, and this option allows the controller to perform a graceful handoff to the OS kernel on boot.
If this option is disabled, the OS and the UEFI will be fighting for the control of the XHCI controller, which at best will extend boot times a bit, and at worst can result in malfunctions, USB devices intermittently not responding, and the very "stuttering" you're looking to prevent.
CPU Frequency Scaling
Modern machines support hardware-managed P-States, which your own guide indirectly mentions when it talks about amd-pstate and recommends setting it into "active" mode to allow the hardware to manage P-State transitions.
However, your guide then goes on to provide examples of of using this scaling driver in a passive or guided mode.
On AMD machines, if you're using "active" control (which is the default and recommended option), the output for:
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driverwill be:
amd-pstate-eppin which case the output for:
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governorswill simply be:
performance powersaveYour guide suggests to set this to "performance". Do NOT do this, as all it will do is lock the CPU at its maximum frequency and prevent it from dropping clocks when idle. "Powersave" is the default and recommended setting -- don't change this for a gaming PC.
When using hardware-managed P-states, the main tunable of interest is the Energy Performance Preference ("EPP") value. If you're on an AMD machine in "active" mode, you can see what values are available with:
cat /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_available_preferenceswhich shows the following on my machine:
default performance balance_performance balance_power power"balance_performance" is the default on my OS, and is the one I'd recommended for general-purpose desktop use. "balance_power" may be useful if you're running on a laptop or a SFF PC that is power- and thermal-constrained, and you want to shift more of the limited power budget to the GPU (which is generally what you'd want for a power-constrained gaming PC).
Let's suppose you're running on an older machine that doesn't have hardware-managed P-states (which is more reflective of the output shown in your guide). Even in that case, I STILL wouldn't recommend setting the scaling governor to "performance". This machines should be using the "schedutil" governor, which is probably already the default option.
Kernel Commandline parameters
Oh boy...
Let's go down the list:
amd-pstateas already described above tells the kernel if the kernel should use control the cpu frequency or the hardware itself. I have amd-pstate=passive because my hardware is not able to boost itself and is otherwise locked to the base frequency.
Anything modern enough to have a direct BIOS toggle for Resizable BAR is modern enough to support hardware-managed P-states. I have a very similar machine to you -- an AMD Ryzen 7 5800X3D running on an ASRock B550M Pro4 -- and I have full hardware P-state support. If your hardware isn't able to "boost itself", that sounds like a skill issue, and you should fix that rather than recommended that people set a kernel parameter that will degrade their system's performance.
amdgpu.aspm=0is used to disable the PCI Express power-saving for amdgpus otherwise the PCI Express link has a wake up latency when it goes into idle state and it wants to wakeup
pcie_aspm=off same as amdgpu.aspm but more
PCI Express wake-up latency is completely trivial for the work that a desktop PC would do. Don't set this.
amdgpu.audio=0to disable the audio over HDMI/DP, i dont need it. I have an external DAC.
Every kernel setting you deviate from the default takes you further from the well-tested "happy path", and leaves you at increased risk of hitting some edge case. Kernel boot parameters should be used to work around hardware quirks, not to suit your aesthetic preferences. Unused DACs can be disabled in your desktop environment's audio settings.
nmi_watchdog=0is for Hard lockup detector and Soft lockup detection of Non-Maskable Interrupts, which uses a watchdog to detect that which needs to run in a set interval. When you disable it you free up some cpu time.
nowatchdogsame as above but for all watchdogs
The amount of "CPU time" freed is completely trivial, and you lose a kernel diagnostic tool. There is a use case where setting this is useful (your software will explicitly tell you that you need to), but "you free up some cpu time" is a bullshit reason. Don't set this.
processor.max_cstate=1sets the max C state or better said idle state to C1. It normally goes until C6 or even lower. The higher the number the deeper the sleep state. The deeper the sleep state the higher the wakup latency, to minimize the latency we do max cstate to 1 and i think you need the Global C state Control option enabled in the bios to really benefit from it.
Wake-up latency from even the deepest sleep states is measured in microseconds, which is trivial for a gaming PC. Meanwhile, preventing your processing from entering a deeper sleep state keeps idle parts of the processor active and generating heat, which reduces how high the processor's clock speed can boost under low to medium load, which will negatively impact gaming performance. Don't set this.
transparent_hugepage=alwaysalways enable thp pages. When we combine them with the tmpfile settings and the sysctl virtual memory (vm) settings then they cooperate very much.
transparent_hugepage_tmpfs=alwaysalways enable thp pages. When we combine them with the tmpfile settings and the sysctl virtual memory (vm) settings then they cooperate very much.
Transparent huge pages have historically caused performance issues for applications that use a large percentage of the system's memory (potentially like a game), to the point where the kernel maintainers have set the default to "madvise", which enables transparent huge pages ONLY if the application explicitly requests them (and is presumably designed to use them). Game engines in particular are tuned for specific memory access patterns, and can perform erratically if that's changed underneath it. Don't set this.
I would go on, but Reddit comments can only be so long, and I think you get the idea by now.
The developers of the Linux kernel, Mesa, WINE, Proton, your desktop environment, and pretty much every other well-established piece of software that makes up your OS generally have default settings that are sensible for a wide variety of use cases, which includes gaming. There is no need to do this kind of tweaking, and in many cases, you're making performance worse and opening the door to stability issues.
For the love of ${DEITY}, just use the defaults. Don't change settings you don't understand just because some "guide" directed you to. Practically all of these guides are ill-informed bullshit.
15
u/noobjaish Oct 03 '26
The more you stray from the base, the harder it is to get help for your edgecase.
-39
u/WhitePeace36 Oct 03 '26 edited Oct 03 '26
Linux is build to fit niche edge cases. The defaults are just a compromises where you can use it sub optimally for all use cases. A gaming rig needs different settings than a server and that needs different settings than an embedded device or a phone.
Linux is build so that you can configure it for the use case you have.
EDIT: So ?
21
u/noobjaish Oct 03 '26
I just wrote that every extra action you take to deviate is a compromise that you have to constantly think about and makes it harder to get/find help when issues arise. The upside has to be worth the trouble. Still, you're free to do whatever you want.
I switched from base Arch to CachyOS and saw basically no improvements in terms of performance.
→ More replies (1)20
30
9
7
6
u/IDUnavailable Oct 03 '26
Why don't YOU write a Linux gaming optimizations guide?
Wait that sounded sarcastic, I'd actually be interested in that.
18
u/theevilsharpie Oct 03 '26
It would basically just say this:
The developers of the Linux kernel, Mesa, WINE, Proton, your desktop environment, and pretty much every other well-established piece of software that makes up your OS generally have default settings that are sensible for a wide variety of use cases, which includes gaming. There is no need to do this kind of tweaking, and in many cases, you're making performance worse and opening the door to stability issues.
For the love of ${DEITY}, just use the defaults.
2
u/IDUnavailable Oct 03 '26
Fair enough, but you don't change any performance-related defaults? There wouldn't be anything worth noting for hardware extremes (e.g. very low or very high RAM or VRAM, bottom percentile vs top percentile CPU, 1080p vs 4K, high performance NVMe SSD vs. SATA SSD, etc.)?
7
u/theevilsharpie Oct 03 '26
For gaming, not anything that would impact performance in any meaningful way.
I occasionally customize settings in
dxvk.conf, usually to force stuff like anisotropic filtering or MSAA in older games that don't directly have toggles for these options.If I were interested in GPU overclocking or undervolting, I'd need to do some tweaking to enable that, but my GPU is powerful and efficient enough, and I'm not interested in turning my PC into a space heater.
Looking at my notes, I do have a few quality of life tweaks that might be useful to others:
# /etc/environment.d/mesa-radv-conformance.conf MESA_VK_IGNORE_CONFORMANCE_WARNING=trueThis will suppress that annoying "WARNING: radv is not a conformant Vulkan implementation, testing use only." message that clutters up the stderr output when running a Vulkan application using the RADV Vulkan driver. (I assume it does the same for other Mesa Vulkan drivers, but don't have the hardware to test that.)
# Time in milliseconds (Default: 5000) $ gsettings set org.gnome.mutter check-alive-timeout 60000On GNOME, this will extend Mutter's liveness heartbeat to 60 seconds (up from 5 seconds). This is done because Windows games running through Proton have static loading screens that tend to exceed the default liveness timeout, and Mutter will frequently annoy me by popping up a box asking if you want to terminate the application.
This may be something that can be fixed within WINE (or some other Proton component), but ehh... adjusting the Mutter timeout solves my problem and lets me get back to the game.
I've customized Google Chrome's application launch with the following additional command-line parameters:
--enable-features=AcceleratedVideoEncoderSo the
Exec=line in the.desktopfile would look like the following:Exec=/usr/bin/google-chrome-stable --enable-features=AcceleratedVideoEncoder %UThis turns on hardware-accelerated video encoding (for things like Zoom, Google Meet, etc.), since this is disabled by default in Chrome.
Additionally, when using an Intel GPU (at least on Ubuntu), you need to install the
intel-media-va-driver-non-freepackage from the apt repositories in order to get useful video hardware acceleration, as the default VA-API drivers don't have support for patent-encumbered video codecs. I think Nvidia GPUs also need additional software to support video acceleration, but I don't have their GPUs to test.1
u/Fasgort Oct 03 '26
suppress that annoying "WARNING: radv is not a conformant Vulkan implementation, testing use only." message
Darn, that one is gold. It's so annoying to debug something and having to filter so many of those darn lines. I assume putting it in a folder at user level (~/.config/environment.d/) would work too, right?
2
u/theevilsharpie Oct 03 '26
Actually, I lied. I do have a tweak that impacts performance.
Ubuntu 26.04 has support for x86-64-v3 packages, but it's not enabled by default on the desktop distribution, since their priority is to maximize compatibility with as much hardware as possible.
If you have hardware that supports x86-64-v3, you can opt-in to these packages like so:
echo 'APT::Architecture-Variants "amd64v3";' | sudo tee /etc/apt/apt.conf.d/99enable-amd64v3 sudo apt update && sudo apt upgradeNote that it will replace almost all the packages on your system, so you'll need to allow some time (and bandwidth) to finish, and will need to restart afterward.
Also, it goes without saying, but this will break compatibility with older hardware that doesn't support x86-64-v3, and the machine will likely not even boot the OS anymore.
More info at https://documentation.ubuntu.com/release-notes/26.04/summary-for-lts-users/#architecture-variants-and-amd64v3
2
2
u/ArchIsGoodToHave Oct 03 '26 edited Oct 03 '26
Very nice clarifications. Thanks.
scx_lavd, scx_bpfland etc; they really don't add any performance increase. I have tested them a lot of times, changing their parameters as well. At best, they can catch the performance of EEVDF if they arenot slower.
I have some remarks:
transparent_hugepage=always increased my performance. Too much? No. But what I observed is that it is not a universal adjustment since it might increase performance in some computers and decrease in some others. I think it was RHEL guide that was advising to "try".
Also, if I do not remember wrong -correct if it is wrong-, Ubuntu has "madvise" as default while Arch and OpenSuse Tumbleweed have "always".
Also, Ubuntu has preempt=lazy as default while the others have "full".
But again, to write preempt=full to the kernal command line does not add anything much remarkable.I can also provide some other comments but no need, because I tweaked my settings for more than a year. And the differences are minor.
The main performance increase (if not only) comes from Mesa - I observed this several times. For instance, I see that Ubuntu will have Mesa 26.2.3 in 26.10 release and it will contribute.
The main thing is that if one can wait about 6 months for a new release, Ubuntu's performance is not minor than CachyOS etc. I use Arch Linux (amd I occasionally try others), and some people may not like this but my system is at least as fast as Cachy when I play games. And Ubuntu is as fast as Cachy OS. So, the "blazingly fast" is a credit to give to Linux kernel imo.Anyways, such things generally do not help. Gaming tweaks: yes, they can be done in some cases; but those who share them should be aware that they may be working in their own hardware etc; most of the tweaks proposed are superfluous or not applicable at all systems. The best way is that one either learns and then tries, or simple leave the system as it is.
1
-21
u/WhitePeace36 Oct 02 '26
dude, from you response alone i can tell that you didn't even try it and looked at the result. with some stats or measurements tools provided by the os.
performance does not lock the cpu to max frequency... just look in the task manager.
the wakeup takes longer the deeper the sleep state for a cpu c state.
if thp always would be so bad why does cachyos and a lot of other distros do it by default ?
my 5800x3d does not support
amd-pstate=activethat is why i wrote it so specific in the guide.regarding
Amd fTPM - Disablewhen you have a home pc and use only linux it is not needed it just a source of problem like it was in the past with bug in the kernel which lead to stuttersfurthermore the other stuff like disabling audio and stuff is opinion based with no right or wrong what so ever.
The one thing which i could look at again is
XHCI HandoffMaybe why it lead to stutters on my side is connected to something more than just this settings alone. I would have to trouble shoot.You seem like a default andy to me to be honest. With this mindset you can never improve at all. If everybody had that mindset then we would be in the stone age.
13
u/SammyKingwood Oct 03 '26
He told you exactly why the TPM is needed (anti cheat in online games). It's not a matter of "oh this is just my home PC and I don't need these security features."
Also it 100% does not lead to stutters anymore, you're just bullshitting.
0
u/WhitePeace36 Oct 03 '26
tpm is not needed for anti cheat on linux ... tell me 1 game which uses it and i can test it but ok. Ok you can test it yourself and not just throw some assumption around without any real testing...
0
u/Indolent_Bard Oct 03 '26
If you dual boot, it's still needed. And I think Linux games are looking into it.
13
u/theevilsharpie Oct 03 '26 edited Oct 03 '26
performance does not lock the cpu to max frequency... just look in the task manager.
Oh, really?
Your guide is showing that you're using Linux kernel 7.1.0-rc2 (lol), so here's the relevant section of the Linux kernel code:
https://github.com/torvalds/linux/blob/v7.1-rc2/drivers/cpufreq/amd-pstate.c#L705-L735
So I stand somewhat corrected -- using the "performance" governor for the
amd-pstate-eppdriver sets the minimum CPU clock at the maximum nominal frequency (aka "base clock"), rather than the maximum possible clock (there's even a comment why -- turns out that hard-setting the clock speeds to "stupid" was counter-productive, who knew?). It still prevents the processor from reducing clock speeds to below base when able, so it's still going to eat into the processor's power and thermal budget, which will prevent it from boosting as high as it otherwise could, particularly on systems that are power- and thermal-constrained.When using passive mode, the scaling driver using standard "CPUFreq" logic, which is documented as follows:
https://docs.kernel.org/admin-guide/pm/cpufreq.html
When attached to a policy object, this [performance] governor causes the highest frequency, within the scaling_max_freq policy limit, to be requested for that policy.
i.e., hard-sets the clocks at at the highest available frequency.
Lastly, looking at clock speeds in a task manager is going to be inaccurate, partly because the cores aren't active when in a sleep state (so there will be periods during the monitoring interval where the clock speeds are "0"), and partly because task managers are intensive-enough workloads to wake the the processors to run the task manager, which will effect the clock speed and cause the the task manager to read high (if only for a moment).
the wakeup takes longer the deeper the sleep state for a cpu c state.
While that statement is technically true, in the context of your guide, it's not meaningful.
Let's take a look at how long it actually takes to wake from a deep sleep state:
lscpu | grep 'Model name'; cpupower idle-infoHere's the output:
Model name: AMD Ryzen 7 5800X3D 8-Core Processor CPUidle driver: acpi_idle CPUidle governor: menu analyzing CPU 13: Number of idle states: 3 Available idle states: POLL C1 C2 POLL: Flags/Description: CPUIDLE CORE POLL IDLE Latency: 0 Residency: 0 Usage: 903 Duration: 21162 C1: Flags/Description: ACPI FFH MWAIT 0x0 Latency: 1 Residency: 2 Usage: 49995 Duration: 3645992 C2: Flags/Description: ACPI IOPORT 0x414 Latency: 18 Residency: 36 Usage: 897427 Duration: 9550533863So if you look at "C2" (which is actually Ryzen's "C6" state, but is mis-labeled as C2 here), the wake latency is 18 microseconds.
So if I were running a game at 250 fps, and had a 4 millisecond budget to process, construct, and present a frame, waiting for this CPU to wake a core from a deep sleep state would take 0.1% of that frame budget. Completely trivial, especially when the trade-off is the ability to boost to higher clock speeds when actually under load.
if thp always would be so bad why does cachyos and a lot of other distros do it by default ?
Because they apparently like pain, and have already run into issues that forced them back to "advise" mode.
CachyOS's reputation as a "meme" distro isn't entirely undeserved.
my 5800x3d does not support
amd-pstate=activethat is why i wrote it so specific in the guide.Oh, really?
Works for me, and I have the same CPU as you. Sounds like a skill issue.
lscpu | grep 'Model name'; cpupower frequency-info Model name: AMD Ryzen 7 5800X3D 8-Core Processor analyzing CPU 4: driver: amd-pstate-epp CPUs which run at the same hardware frequency: 4 CPUs which need to have their frequency coordinated by software: 4 energy performance preference: performance hardware limits: 576 MHz - 4.55 GHz available cpufreq governors: performance powersave current policy: frequency should be within 1.76 GHz and 4.55 GHz. The governor "powersave" may decide which speed to use within this range. current CPU frequency: Unable to call hardware current CPU frequency: 3.96 GHz (asserted by call to kernel) boost state support: Supported: yes Active: yes amd-pstate limits: Highest Performance: 166. Maximum Frequency: 4.55 GHz. Nominal Performance: 124. Nominal Frequency: 3.40 GHz. Lowest Non-linear Performance: 64. Lowest Non-linear Frequency: 1.76 GHz. Lowest Performance: 21. Lowest Frequency: 550 MHz. Preferred Core Support: 1. Preferred Core Ranking: 171.regarding
Amd fTPM - Disablewhen you have a home pc and use only linux it is not needed it just a source of problem like it was in the past with bug in the kernel which lead to stuttersIt is not for you to determine if a TPM is "not needed". There are situations where it is, and turning it off in those situations can range from games or applications that use it not working, to the entire machine being rendered unbootable.
There are no known issues currently (that I'm aware of) with AMD's TPM on current BIOS versions. Leaving it on but unused just results in it sitting inert, which is a safe and reasonable default. Your repeated claims that AMD's TPM leads to "stutters" is not accurate.
furthermore the other stuff like disabling audio and stuff is opinion based with no right or wrong what so ever.
The best-tested settings are the default ones. Anytime you customize your settings, you're veering away from that default. Setting a kernel boot parameter isn't necessarily a bad thing (e.g., to work around a particular quirk of your hardware), but it's not really the place to practice your configuration Feng Shui, and advising others to do it for this reason is irresponsible.
You seem like a default andy to me to be honest. With this mindset you can never improve at all.
I have been dealing with Linux performance tuning longer than most of the folks on this subreddit have been alive. In my professional life, I manage the configuration and performance tuning of large systems running on cloud environments, which directly affects how much it costs, and my guidance has saved my employer millions of dollars per year.
If I'm recommending a particular configuration (or am being recommended one), I want to know why, what that configuration hopes to achieve, what the trade-offs are, and what kind of practical effects can be expected (e.g., just because a setting can improve performance in theory, doesn't mean it improves performance in ways that actually matter).
And you know what I've found? The defaults are usually fine. Turns out that other professional developers put a lot of thought into the performance of their software in various cases, and they usually do a good job of doing the right thing by default. Sometimes it's necessary to adjust a default, but that should be paired with a good reason why.
Most of these "gamer tweak guides" don't go into that level of depth (usually because their authors themselves don't know and are just parroting what they've read elsewhere), which is how they end up with a document filled to the brim with easily-disproven bullshit.
0
u/WhitePeace36 Oct 03 '26 edited Oct 03 '26
i used 7.1.0-rc2 at the time the guide was created. I would need to update this information. But you could also have looked it up in the commits and you would have known but nevermind.
a core goes automatically into C1 state when there is no task to run and there is a lot of times no task to run. Except when there is 100% cpu usage. And when it has something to run It goes to C0 and to be have it run there with the highest frequency possible is exactly what we want.
idk why it works for you but when i use amd_pstate=active my cpu does not boost at all and is stuck at base clock as described in the guide. So i use amd_pstate=passive to get it to boost.
The guide also says that you should use amd_pstate=active when posssible btw but it seems you didn't read correctly. Only in such a case as mine that the cpu doesn't boost you can try passive.
Again, for the ftpm issue. You again didn't read correctly. It seems like you have to work on your reading comprehension mate. I wrote: " There has been some bugs where this caused some stutters, but i don't know if this is fixed already. Better to turn it off."
In your case the default might be fine. But for example the os for a cnc machine it is everything else as fine. You need the preempt real time settings there and some other stuff to get it to work at all.
It is use case dependent. For server usecases the eevdf might be fine but for games it is absolutely bad. You just need to look at frametime graphs while running gaming benchmarks. Why else do you think lavd was created? It was created for latency sensitive applications. Which a game is.
You also need to configure a mail server differently than some AI one. On a mail server you will need more inodes than on a normal one. You also choose the filesystem type based on the workload. Same for the virtual memory settings, cpu, graphics card, cpu scheduler and so on.
The best is not the default. Never was and never will be. The default is only a compromise which fits the most areas with usable enough values.
But i can't really fault you for not knowing the importants of this stuff. You are no developer so you don't know. With your mindset you also wouldn't be able to be one.
1
u/theevilsharpie Oct 03 '26
It is use case dependent. For server usecases the eevdf might be fine but for games it is absolutely bad. You just need to look at frametime graphs while running gaming benchmarks.
OK, let's do that.
SCX_LAVD vs CachyOS Scheduler โ Does It Improve Gaming Performance?
EEVDF seems to perform just fine, and in many cases, outperforms the LAVD scheduler (sometimes significantly).
Similar claims were made about the BORE scheduler, which also didn't actually hold up in objective tests.
In fairness to LAVD, the presentations I've seen about its development suggest that efficiently utilizing heterogeneous cores in power-constrained devices is the main target of optimization (at least at this stage of development), so had EEVDF and LAVD been compared against each other on something like a smartphone, maybe things would have swung in LAVD's favor.
But there's nothing wrong with EEVDF for a more typical gaming PC, and that's because...
Why else do you think lavd was created? It was created for latency sensitive applications. Which a game is.
...from the perspective of kernel performance optimization, games are throughput workloads; they are NOT latency-sensitive, and tuning your system for low latency will negatively impact game performance. This fundamental misunderstanding is on display throughout your guide (even though your "Introduction" section explicitly calls it out).
The best is not the default. Never was and never will be. The default is only a compromise which fits the most areas with usable enough values.
This is a very "junior engineer" way of thinking. I encourage you to become familiar with the principle of Chesterton's Fence before investing much more time into these "guides".
1
u/WhitePeace36 Oct 03 '26 edited Oct 03 '26
benchmarks i did right now... But if you are blind then i can also accept it.
You don't even know what he configured in the guide... It could be anything.
And games are latency sensitive... They wait on external events. They send stuff to render to the gpu. The thread then has to wait for the event for it to finish. They have to wait for input data over the network from the server, they have to listen to keyboard and mouse events. They read and write data to and from filesystems all the time. So a lot of filesystem events. Allocating memory when there is no free space because it is full with cached and dirty data. Then you have stalls at memory allocation time, where maybe some dirty data first has to be written to disk and then kcompactd has to step in to defragment the memory to get enough free pages for the allocation. And then the source application has to be woken again. A lot of context switches and stalls... And when any of the events is not handled immediately then that leads to stalls which we notice as stutters and hitches. This is all latency sensitive... So latency is here very paramount.
Throughput is like rendering something. Where you don't have a lot of events happening and if there are some than there are not latency sensitive. So here it doesn't make any difference when the event gets handled like 2ms later.
But for latency sensitive applications 2ms is a lot. This is the most true for use cases where you need a real time os like a cnc os. There latency is paramount. Without it the machine cannot drive around precisely and you can't cut anything because the measurements are all off.
I think you are just stupid. You give yourself as if you know anything but you know nothing. You don't even do benchmarks yourself and only look up stuff others did anyhow without even knowing the configurations... This is rookie behavior. You give yourself like an all knowing thug. But in reality you have no idea what is happening. I am not saying i know anything because i don't. But to be so ignorant and assume stuff which is absolutely not the reality is just fucking stupid. I think you have to come down from your high horse and look at facts.
You cannot reach the same kind of performance with a generally configured os as with one which is specifically configured and made for that use case!
something even better https://imgur.com/a/qz7ucjy
1
u/Anthony25410 Oct 03 '26
Thank you for the link to the code! I was convinced that the minimum frequency was set the the 17, Lowest non linear freq, because that's what is showed for idle cores.
But reading the amd_pstate code and checking in MSR, you're indeed right, the min_freq is not used in performance mode. Thanks for breaking my believes :p!
Just one thing that is changing with linux 7.3, is that if your Bios requests a min frequency, it'll now override this behavior. But if I understood correctly, it's an option you have to manually enable in the bios settings.
1
u/Anthony25410 Oct 03 '26 edited Oct 03 '26
my 5800x3d does not support
amd-pstate=activethat is why i wrote it so specific in the guide.This is strange, it should support it. I had it enabled on my 5950x by default. Do you have CPPC enabled in your bios?
performance does not lock the cpu to max frequency... just look in the task manager.
Yes, and even more in
activemode. What it does is by default it locks it to the lowest optimal frequency in term of frequency. You can see that withcpupower frequency-info. Example, on my 9950x (and it's valid since zen 2):amd-pstate limits: Highest Performance: 166. Maximum Frequency: 6.00 GHz. Nominal Performance: 119. Nominal Frequency: 4.30 GHz. Lowest Non-linear Performance: 17. Lowest Non-linear Frequency: 614 MHz. Lowest Performance: 17. Lowest Frequency: 600 MHz.Here the
17. Lowest Non-linear Frequencytells which frequency will be the minimum. It's also the case if you are inpowersavewith at least abalance-performanceEPP mode (if I remember correctly).Performance is basically powersave with the EPP mode locked to performance, so the time needed to jump to the highest frequency will be set to the lowest. Which is what you want if you have thermal headroom. Otherwise, if the CPU tends to throttling, powersave with an EPP mode set to
balance-performancemight give better results.regarding Amd fTPM - Disable when you have a home pc and use only linux it is not needed it just a source of problem like it was in the past with bug in the kernel which lead to stutters
Yes, it used to be true, now the kernel has a hardcoded list of TPMs it ignores (to avoid the problems you're listing), so it shouldn't be needed. With an updated bios, you should also not encounter the problem anymore.
Edit: My statement about the Lower Non Linera Frequency is wrong, after reading the comments from /u/theevilsharpie.
htop or turbostat will show the lowest frequency for idle cores, but it actually doesn't matter. What is set for any core non idling is indeed the nominal frequency.
44
1
u/ArchIsGoodToHave Oct 03 '26 edited Oct 03 '26
It's a very long cmd line full of parameters, but you use CachyOS. If you look at the default settings of CachyOS, you will see that most of your parameters are already default values.
I do no longer use CachyOS (I use Arch, though), but watchdog settings should be also default - there should be somewhere under sysctl.d settings.
Ok, I found it. Check this please:
https://github.com/CachyOS/CachyOS-Settings/blob/master/usr/lib/sysctl.d/70-cachyos-settings.conf
So is the case with preempt=full. CachyOS's default is preempt=full already.
You can check it with e.g,:
sudo dmesg | grep Preempt
Delete kernel cmd line, and try - it should already be full.
I do not want to be criticizing or showing off, but this is generally the case with tweaks - most of them are superfluous, or not applicable to "all" systems.
Frankly, if Mesa/Vulkan is up-to-date (AMD you use apparently), and especially under CachyOS, you do not need these tweaks (or say, most of them).
And the same applies to transparent_hugepage. Cachy's default is always. Ok, for another distro, it might be the case to add it to kernel parameters as long as it has madvise or none. But generally the difference is not much significant, and "always" might not be optimal for all systems -again-.
Also, sysctl settings; you are talking about much RAM in some cases; this exactly relates to swappiness as well. My system does not use swap at all (huge RAM capacity); so 150 is a value that encourages the use of swap which can be good for systemc with limited capacity, but again, it is also CachyOS's default I think and is NOT applicable to all systems. Arch Wiki has a very nice writing about possible calculations of writebacks or their ratio. I would recommend you to have a look at there.
zram is the same thing. CachyOS uses it but with some remarks that also entail to shift to zswap when applicable -as far as I remember-
Zswap might be efficient for most cases.
I would suggest to have a look at both interesting articles:
https://chrisdown.name/2026/03/24/zswap-vs-zram-when-to-use-what.html
https://linuxblog.io/zswap-better-than-zram/
I was using zswap with lz4 compression; but again, it does not add much. So, default values would be fine there as well without any further tweak.
So, I am enthusiastic about tweaks myself but generally default ones are fine as they are. Even znver4 was not making much difference when I had used; and I could never see the contribution of BORE, or scx_scheds and such. That is why I comfortably use Arch, and boot it with linux-zen kernel which already is optimal for gaming in my case. And when I was trying CachyOS against Arch, I must say Arch was even slightly and also steadily faster than Cachy - so many tries that minimize the possibility of margin error.
So, it is great if you benefit from such settings, but I am confident they are not aplicable to all systems as I tried to explain above, let alone the different default settings from one distro to another, and yet all of them provide optimal values in their own environment.
2
u/WhitePeace36 Oct 04 '26
i mean you do you. But thx for the for the zwap article i will look into them.
Yes, quite a bit of the optimizations which cachyos does by default are also in this guide, but one thing to keep in mind is that the other stuff i described in the guide like
vm.compaction_proactiveness = 40 vm.watermark_scale_factor = 500and the stuff in the tmpfiles section is complementary to the THP-always setting. Without these additional settings i have found that THP-always makes things worse.
I know that it is not applicable to all systems. But most of these settings you can use them there anyway because they are in a good enough ratio. If your use case is gaming. If it is not gaming then you would need different stuff.
Faster, depends on faster in which use case.
And the guide at the beginning also says this:
"Furthermore NOTHING of this is mandatory and you are free to apply and use what you want. I am just documenting what i found, use and some things which made problems for me."
And the guide also says even in the title LinuxAMDGamingOptimizationGuide so the optimization in there are specifically for the gaming use case.
0
u/GrandBIRDLizard Oct 02 '26
Hey with your tinkering with AMD and scx_ext you may quite enjoy this tool I've been tinkering with. It's about to undergo a major refactor and has my own matching kernel patch so as to include BMQ, PDS, and Kyber. here's the patch the kernel is 6.19 and needs to be updated(I'll have that done soon) and if you got the hardware I'd love some feedback back and results. It works on top of any scheduler(results may vary) but by the time the refactor is done it'll probably be some of the best low latency tooling I've used on my rig, usable on any configuration.
1
9
u/Ok-Rooster-8552 Oct 02 '26
most of the things you mention comes pre applied on cachyOs that's good
except
sysctl vm.compaction_proactiveness vm.watermark_scale_factor vm.watermark_boost_factor vm.dirty_writeback_centisecs
so Thanks for the guide