back to home
PSA: tuned is ruining your performance
so is power-profiles-daemon, so is your gamemoded config. for the love of god, stop setting your cpufreq scaling governor to performance
PSA: tuned is ruining your performance
hello again everynyan. this post is mainly intended for laptop/handheld g*mers, specifically for those limited by the integrated GPU, but also has information that applies to desktops. i recommend that you read it to the end regardless of what kind of system you have, or if you even play games. there are no ads on this blog and you'll make me happy :D
if you just want the fix, navigate to the fix.
to address the title. i've been using a thinkpad e14 gen 6 (155h + 16x2 GB DDR5-5600) (i got the ram for $50 before the crisis 🥲) as a second machine for a year now, and there has been an issue i've had since day 1: The Performance Power Profile Does Not Work For Games. sure, it will make your compilations go way faster, but it will slow games down to a crawl. so i've been avoiding using it. that is until today, when i decided to spend even MORE precious hours of my life optimizing tf2. such is the life of the unemployed nerd. and what i noticed blew my mind. the whole package is limited to 15W !!! including the RAM, CPU, iGPU. so i tried rawdogging the intel-rapl{,-mmio}:0 power limit configurables, to no avail. after some research, i decided to check up on thermald to see how it's doing, since there is no trusting intel software. i ran systemctl status thermald, and the output had something weird in it:
Sep 30 14:44:56 thinkpad systemd[1]: Starting thermald.service - Thermal Daemon Service...
Sep 30 14:44:56 thinkpad thermald[1250]: NO RAPL sysfs present
Sep 30 14:44:56 thinkpad thermald[1250]: 35 CPUID levels; family:model:stepping 0x6:aa:4 (6:170:4)
Sep 30 14:44:56 thinkpad thermald[1250]: [/sys/devices/platform/thinkpad_acpi/dytc_lapmode] present: Thermald can't run on this platform
Sep 30 14:44:56 thinkpad thermald[1250]: Unsupported cpu model or platform
Sep 30 14:44:56 thinkpad thermald[1250]: Try option --ignore-cpuid-check to disable this compatibility test
Sep 30 14:44:56 thinkpad systemd[1]: thermald.service: Deactivated successfully.
Sep 30 14:44:56 thinkpad systemd[1]: Started thermald.service - Thermal Daemon Service.
it tried to start, failed due to unmet dependencies (as i said, there's no trusting intel software. the easy fix to this is to wait for /sys/class/powercap to be mounted, which is piss easy to do in systemd services). it started successfully on the second try though, so there's that. but one line caught my attention:
[/sys/devices/platform/thinkpad_acpi/dytc_lapmode] present: Thermald can't run on this platform
huh. i've never heard of that before. i checked the file, and it's set to 0. okay. i googled it and found out another configurable: /sys/firmware/acpi/platform_profile.
that shit is the real deal. setting it to performance actually raised my package power limit to the full amount! so i checked what tuned does with it. it apparently sets it to balanced on the balanced profile, and performance on the throughput-performance (the 'Performance' option in your DE) profile. bingo! that's why CPU-bound tasks become so much faster!
i already had my theories on why it ruined iGPU-bound gaming performance: The Fucking Scaling Governor. i checked the definition of the throughput-performance profile, and yup, it sets the governor to performance. this might be desireable on older, dumber CPUs that don't do their own power management, but the year is 2026. the average consumer cpu has mixed core types and instruction sets. setting it to Always Be On Max Frequency just makes the CPU overheat. here's the relevant snippet:
[cpu]
governor=performance
energy_perf_bias=performance
min_perf_pct=100
energy_performance_preference=performance
boost=1
[acpi]
platform_profile=performance
you can find the whole file at /usr/lib/tuned/profiles/throughput-performance/tuned.conf on your own system :)
let's break down the options:
governor=performance: setscpufreq/scaling_governortoperformance. this makes it so all the cores will be pegged to the maximum frequency they can reach. this effectively disables boost on shitty intel cpus which are power/thermal throttled at maximum frequency anyways. however, it increases throughput considerably. luckily, there's another way to achieve the same thing without burning out your cpu (more on that later).energy_perf_bias=performance: honestly, i don't know what this does. changespower/energy_perf_biasfrom 6 to 0. probably a mixed core thingie.min_perf_pct=100: dogshit boost configenergy_performance_preference: hilariously, this option doesn't do anything if the scaling governor isperformance. it only works onpowersave. lol.boost=1: take a guessplatform_profile=performance: sets/sys/firmware/acpi/platform_profiletoperformance. basically tells the BIOS via ACPI (old OS<->firmware communication standard frontiered by Intel, see this interview with linyos torovoltos) "hey, we need more performance". and on this platform, the BIOS responds by raising the package power limit, which is what we want.
now that you understand the problem, lets move onto the solution.
the fix
the fix is to simply create a drop-in override for the throughput-performance profile. you can create overr-
ooh im a lazy fuck i want a copypaste version
sudo mkdir -p /etc/tuned/profiles/throughput-performance
sudo tee /etc/tuned/profiles/throughput-performance/tuned.conf <<EOF
[main]
include=throughput-performance
[cpu]
governor=powersave
energy_performance_preference=balance_performance
[acpi]
platform_profile=performance
EOF
sudo systemctl restart tuned
cough you can create overrides under /etc/tuned/profiles/<profile name>/tuned.conf as per tuned.conf(5). so, we create the directory /etc/tuned/profiles/throughput-performance and open /etc/tuned/profiles/throughput-performance/tuned.conf in an editor. we can then tell it to inherit options from throughput-performance, and set our own overrides. this effectively acts as a drop-in override file.
[main]
include=throughput-performance
[cpu]
governor=powersave
energy_performance_preference=balance_performance
[acpi]
platform_profile=performance
one thing to note here is energy_performance_preference. try both the balance_performance and performance values, per workload. the performance option will cause it to clock higher overall, and react faster to load changes. however, it will use more power. balance_performance seems to be the sweet spot in my use case. what's even funnier is that balance_performance is the default for the tuned balanced profile.
there is no reload option for tuned, so you have to restart the service with the command systemctl restart tuned, which will apply your changes immediately (it remembers last selected profile!). that's it. that's the fix. put it in your nix config or whatever i dont car
PROOF?? ERMM DO YOU HAVE ANY EVIDENCE??????
here:
TF2 Launch options: MANGOHUD=1 taskset -c 0-3 gamemoderun %command% -novid -nojoy -nosteamcontroller -nohltv -particles 1 -threads 3 -no_texture_stream
config: slonk/tf2-mod-config, standard preset (sq)
thanks for reading! this has been a public service announcement.