GTA5 on Linux (Ubuntu 24.04 + Preempt Boost)

https://www.youtube.com/watch?v=KSNSCprz2Rg

GTA5 on Ubuntu 24.04 + Preempt Full ends up achieving the maximum FPS cap of 188 FPS. The cap gets hit multiple times as a matter of fact.

Compared to the previous video where Ubuntu 24.04 ended up adding 50+ FPS to the game, this one ends up adding the maximum allowed FPS to the game.

Obviously I gotta do a video about this game and about 10 more because Ubuntu is turning 2024 into the year of gaming on Linux (No joke here). I tested and compared even 8 of the games yesterday to their counterparts on Windows 11. On Ubuntu I was getting with the same hardware (or even less) better FPS and performance than on Windows.

5 Likes

It’s funny you mention this. Just yesterday I upgraded my son’s Edubuntu laptop from 23.10 to 24.04 and I made sure to enable preempt=full in the boot parameters. We have a Steam installation via the Steam snap with several games. His computer runs Intel Iris XE graphics, so we don’t expect much out of it, but we were super surprised at the performance with what it has!

Recently he’s become a fan of the game “Hollow Knight” which runs natively. Upon playing it, we both noticed that it was running smoother and with no crashes unlike under Windows where it would crash randomly.

We also installed the game “My Singing Monsters” which is a game he enjoys on touch screen platforms (free to play), but has to run via Proton. Seems to run without a hitch here as well.

I’m having him experiment some more as well. For context, my son is Jonathan Eickmeyer, and is a major contributor on an advisory and testing basis to Edubuntu. As a 12-year-old and entering seventh grade this year, and as an online school student, he is perfectly positioned to advise on what students need in an educational operating system from a student’s perspective. He’s also been the youngest registered attendee of Ubuntu Summit for two years in a row (2022 and 2023).

Edit: As for my own experiments, I’ve been doing the same under Ubuntu Studio 24.04. I switched to the generic kernel from the lowlatency kernel and am using preempt=full nohz_full=all threadirqs as my boot parameters and have added them as checkboxes to “Ubuntu Studio Audio Configuration” to automatically add to the kernel boot parameters via GUI for users of Ubuntu Studio in 24.10 coming out in October.

So far, I’ve seen exactly what you’re seeing: tremendous performance improvements on the gaming side, especially in terms of framerate, mostly playing “Euro Truck Simulator” and “American Truck Simulator” which run natively but can be hit/miss on framerate since the last update (1.50). That said, in my last session since making the changes, it ran much smoother than before I made the switchover to the generic kernel with the kernel parameters mentioned and after the 1.50 update.

For audio production, I’ve noticed some decent performance as well, but I’m going to have to jump into the deep end there with some production level mixing and mastering to know how it’ll turn out for sure.

2 Likes

It appears in new enough kernels you can just

echo full > /sys/kernel/debug/sched/preempt

as root.

If full performs dramatically better than the default voluntary mode then it suggests at least one place exists that could do with explicit preemption. Because in an ideal world, voluntary shouldn’t perform that much worse than full.

I also wonder if that place is in the kernel or if user space can do something about it.

WOW!. You have to be super proud as a dad right there. I am also introducing both of my kids (6 and 8) to Linux via Ubuntu. Right now they do play Goat Similator 3, Minecraft and some math games.

For this part:

nohz_full=all threadirqs

What is going on there. What are those 2 parameters used for?

My whole paramater list is this:

GRUB_CMDLINE_LINUX_DEFAULT=“mitigations=off nvidia-drm.modeset=1 ibt=off split_lock_detect=off split_lock_mitigate=0 nokaslr”

GRUB_CMDLINE_LINUX=“vdso=0 ignore_rlimit_data nvidia-drm.modeset=1 sched_migration_cost=512 pci=nommconf preempt=full”

Some because I hate garbage on dmesg, others because Asus has not yet fix some z790 stuff 100%. Almost there but not 100%.

1 Like

Thank you boss!. If there is anything I can test let me know.

Well, you can see right from the screenshot I posted what they do.

xruns = buffer over/under runs. causes crackling/skipping.

Omggg that’s a very small image on my screen for some reason. I actually thought it was like 3 terminal lines of some code.

That’s pretty COOL something that shows parameters like that. Thank you.

If you click on it, it will zoom in.

Well, you were TOTALLY right as always. The boost was visibly noticeable.

Hogwarts Normal - Average FPS of 63 FPS for a 10 Second scene.

Hogwarts Tweaked - Average FPS of 69 FPS for a 10 Second scene. A 9% FPS Increase.

God Of War Normal - Average FPS of 100 FPS for a 10 Second scene.

God Of War Tweaked - Average FPS of 130 FPS for a 10 Second scene. A 30% FPS Increase.

So CPU bound games or games that rely more on CPU will benefit even more. Of course the test was simple, just the loading scene when cutting down the tree on GoW (I waited 10 seconds to notice an average), and just outside the first town in Hogwarts Legacy, same thing. Waited 10 seconds to notice an average.

Also tested Cyberpunk and it had 2 FPS more as an average on a specific place I always use to test the FPS performance. Basically depends on what the engine requires the most and where in the game we are.

2 Likes

Hey Daniel! Good to read you!

These parameters were suggested by @arighi in Fine-Tuning the Ubuntu 24.04 Kernel for low latency, throughput, and power efficiency, so they weren’t without forethought or previous discussion. Additionally, other discussions took place in Ubuntu 24.04 Boosts Gaming Performance.

For audio production, I’d absolutely prefer full over voluntary, but for gaming, as you can see, @luisalvarado is seeing some minor increases which, while minor, every little bit helps.

The other noteworthy piece was the power consumption decrease he noted in the previous post, so there’s definitely something to this beyond performance increase.

Either way, your echo full > /sys/kernel/debug/sched/preempt is something I’m going to be integrating into the Ubuntu Studio Audio Configuration wizard so that users don’t have to reboot for the command parameters to take effect, but can make the changes on-the-fly. I’m not sure if the other parameters can be done in a similar manner, but more research needs to be done on that front.

Thanks @eeickmeyer. That article was posted just as I started a month of travel, so it makes sense I missed it.

@eeickmeyer I noticed today after trying to render a video with kdenlive (And also noticing why all game recording were never using 100% of the CPU. Was basing this on the temperature readings) that when using nohz_full=all it would fix every cpu core/thread to 800Mhz on the 13900K I have, and only allow a max of 3ghz on Core 0 as seen here:

2024-07-14_09-58

Just something to be aware of (I was not aware of this). What I am not understanding, and apologies for this, is why would a game show better performance, but then kdenlive rendering something would take more than 10x to render a video with using parallel mode.

UPDATE:

I started reading here: https://docs.kernel.org/timers/no_hz.html

and from the small amount I have been able to gather it looks like doing this nohz_full=all is prohibited, or basically will never happen by the logic mentioned in the documentation. And because of this (And the last part of the documentation) it would more or less explain why I am getting only one core “active” in powersafe mode forever and the other ones in sleeping beauty mode.

Luis, this is very good information from a video editing perspective. As a video editor myself, doing nohz_full=all makes sense only if the CPU governor is set to performance. I’d recommend installing cpupower-gui to be able to make those adjustments.

image

This is a utility that will be installed by default in Ubuntu Studio.

That said, some of the adjustments in recommended for gaming or audio might not be a good idea for video rendering. Also, kdenlive is very CPU-heavy unless you have a dedicated GPU. I happen to be lucky and have a dedicated GPU and have enabled the GPU features and have seen performance improvements when rendering using the NVENC options.

I’d very much like to hear what @arighi has as far as any opinions on this.

Thank you. I ended up removing cpupower-gui today because I thought it broke when I tried figuring out why the performance was always in powersafe and even on performance it never went up. Like only the first core did follow the cpupower-gui, but all others stayed in 800Mhz (Meaning, even if I did All CPUs in cpupower-gui and set them all forced to 5500Mhz, it would only affect core 0, the rest would stay in 800Mhz.

for the NVENC option, I did try it in kdenlive today but still the time it took to render was almost half an hour when I was doing it in about 1 minute or less before. Could be that the Kdenlive new update did something maybe. I have not checked.

I haven’t tried parallel threading with kdenlive because there are warnings about artifacts, but I guess YMMV.

It works great, at least a bunch of the videos at https://www.youtube.com/@xtremelinux are done using it to save myself A LOT of time.

Also it took me a while to understand that YMMV is NOT “Your Mother Might Visit”.

1 Like

Forgot to do the same God of War test, so here it is. Without the nohz_full=all there is a drop, but just a few FPS (It was actually around 127 FPS when I took the picture, not 128 FPS). So the average was 127 FPS. Not something to cry about.

Ok, so in terms of gaming and video editing, nohz_full=all is not something to use necessarily. However, for audio, we want to keep the processor from dropping as much as possible to prevent xruns (buffer overruns/undrerruns), so it may be desirable.

I may make it so that nohz_full=all is optional for Ubuntu Studio and not default, while keeping preempt=full and threadirqs in order to serve the widest audience. For those that need the absolute lowest latency, they can enable nohz_full=all in the Ubuntu Studio Audio Configuration utility.

If my mother visits, I’d have no problem. :rofl:

1 Like

Well am not at your level of knowledge, just learning about this parameters so whatever you decide I will follow.