Negative nice values
From man nice:
Run COMMAND with an adjusted niceness, which affects process scheduling.
With no COMMAND, print the current niceness. Niceness values range from -20
(most favorable to the process) to 19 (least favorable to the process).
However, in the example gamemode.ini, it is stated:
; GameMode can renice game processes. You can put any value between 0 and 20 here, the value
; will be negated and applied as a nice value (0 means no change). Defaults to 0.
Shouldn't we be able to put negative nice numbers as well?
Thanks!
Hey @marchellodev,
Good question but unfortunately this isn't possible as negative nice number need root access so unless gamemode were to do something funky with suid binaries (not recommended for security reasons) or something to that effect it would not be possible for it to set the negative niceness.
You can test this yourself by just doing:
nice -n -1 vim
Then you will see an error something like:
nice: setpriority: Permission denied
Thanks,
Alan Jenkins
@alanjjenkins I'm unsure if you're mistaken here, though it's been a few years since I touched the code.
As described in the comment that was quoted, the value will be negated (so entering 20 will then try to renice the game to -20). You can also see this here in code: https://github.com/FeralInteractive/gamemode/blob/b11d2912e280acb87d9ad114d6c7cd8846c4ef02/daemon/gamemode-sched.c#L89.
hello there. how do you make it work? if I change renice in gamemode.ini, I only get errors:
::: Verifying renice ERROR: renice value not set correctly after gamemode_request_start Expected: 5, Was: 0 ERROR: Initial values for new threads were incorrect! ERROR: Multithreaded renice tests failed! ::: Failed!