I’d like to disable some services that might decrease my gaming performance while a game is running. Stuff like search indexing, automatic updates, filesystem tasks.
Has anyone done something in that direction?
My spontaneous idea was to use gamemode to switch to a systemd target that disables those services. Although I’m not sure if systemd targets actually can disable services or if they can only start them. Might also be a little overengineered.
If I don’t get a better idea I will just run a start and stop script with gamemode to handle all that. Although I’m not sure if that would be able to stop system services. Will cross that bridge when I get there.
Edit: While I can automatically stop services by starting a target they aren’t started again after stopping the target. I guess I will just use some simple start-gaming and stop-gaming scripts.
As far as base services go Linux doesn’t really have that many that would be resource hogs.
For giving CPU preference to your game you can use
nice
. For keeping pages of memory from being invalidated you could maybe usemlock
but I have no experience with that tool. Unnecessary use of the GPU would probably be the biggest drag. For your distro or desktop environment you should see if it has a “game mode” or any settings you can toggle that normally use the GPU.gamemode is a simple program to do all that stuff for you. Calling it is built into some games like those by Feral Interactive. And it is available in game helpers like Heroic and Lutris.
It also has the ability to run custom commands when starting and quitting your games. I’ll be using those.
Bazzite runs gamemode by default