FeralInteractive / gamemode

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

Feature Request: renice and ionice other applications to lowest priority #405

Open emansom opened 1 year ago

emansom commented 1 year ago

Is your feature request related to a problem? Please describe. GameMode can be configured to renice processes and this works accordingly.

However, other processes like Firefox have similar implementations, often running media processes/threads at higher process priority.

In some scenarios this leads to extra stutter, when e.g. a JavaScript heavy and media heavy website (e.g. YouTube) is playing within Firefox in the background on a low-end (e.g. laptop) processor.

Describe the solution you'd like GameMode to implement a whitelist of processes it scans that will periodically be reniced to a default of 0.

This ensures the game processes always has the highest CPU allocation.

emansom commented 1 year ago

Current workaround:

Define the following in gamemode.ini

[custom]
start=/home/ewout/.local/bin/gamemode-lowprio-apps

~/.local/bin/gamemode-lowprio-apps

#!/bin/sh
apps_to_low_prio=('firefox' 'telegram-desktop' 'qbittorrent')

for app in $apps_to_low_prio; do
  for pid in $(pidof $app); do
    renice -n 0 -p $pid;
    ionice -c 3 -p $pid;
  done;
done