FeralInteractive / gamemode

Optimise Linux system performance on demand
BSD 3-Clause "New" or "Revised" License
4.78k stars 185 forks source link

Change CPU frequency limits #306

Open Shallrath opened 3 years ago

Shallrath commented 3 years ago

Is your feature request related to a problem? Please describe. I only want to use my high overclock during gaming, but not e.g. when encoding a video over night, so I think it would be nice to use gamemode for this. In my example, I want my Intel i7-6700k to speedstep between 800 and 4000 MHz during regular desktop usage and stay at a constant 4600 MHz during gamemode.

Describe the solution you'd like It would be nice to specify the CPU frequency in gamemode.ini so the CPU gets adjusted to this frequency when gamemode is active and reverts to the previous boundaries when exiting gamemode.

Describe alternatives you've considered I could change the frequency boundaries myself using cpupower frequency-set but this must be done as root so I can't just include it in a custom script to be run by gamemode. I think setting the upper limit is enough because gamemode switches to the performance governor which keeps the CPU clock at the upper limit.

tassaron commented 3 years ago

It is possible to allow a certain command/script to be run as root without a password by editing the sudoers file with sudo visudo. Something like myusername ALL = (root) NOPASSWD: /path/to/my/program. Maybe it won't work in this case... I've only ever done this once in my life, to make a laptop turn off its screen at boot, so there's a good possibility it won't work for something more complex? But maybe you can give it a shot! Sorry if this isn't helpful 🙃

Shallrath commented 3 years ago

That's exactly how I'm doing it right now. I just thought as gamemode is already adjusting CPU performance by changing the governor, also adjusting the frequency would fit quite well into gamemode's built-in feature set.