config: Allow renice configuration

This commit adds configuration support for the renice value and amends
documentation and examples. This commit by itself does nothing, the
following commit is needed to actually apply the new settings.

Signed-off-by: Kai Krakow <kai@kaishome.de>
This commit is contained in:
Kai Krakow 2018-06-10 09:33:02 +02:00
parent addfe1fbc0
commit 57c6bbb444
5 changed files with 25 additions and 1 deletions

View File

@ -7,7 +7,7 @@ GameMode was designed primarily as a stop-gap solution to problems with the Inte
GameMode can leverage support for soft real time mode if the running kernel supports `SCHED_ISO`. This adjusts the scheduling of the game to real time without sacrificing system stability by starving other processes.
GameMode adjusts the nice priority of games to -4 to give it a slight IO and CPU priority over other background processes. This only works if your user is permitted to adjust priorities within the limits configured by PAM.
GameMode adjusts the nice priority of games to -4 by default to give it a slight IO and CPU priority over other background processes. This only works if your user is permitted to adjust priorities within the limits configured by PAM. See `/etc/security/limits.conf`.
Issues with GameMode should be reported here in the issues section, and not reported to Feral directly.

View File

@ -68,6 +68,7 @@ struct GameModeConfig {
char desiredgov[CONFIG_VALUE_MAX];
char softrealtime[CONFIG_VALUE_MAX];
long renice;
long reaper_frequency;
};
@ -161,6 +162,8 @@ static int inih_handler(void *user, const char *section, const char *name, const
valid = get_string_value(value, self->desiredgov);
} else if (strcmp(name, "softrealtime") == 0) {
valid = get_string_value(value, self->softrealtime);
} else if (strcmp(name, "renice") == 0) {
valid = get_long_value(name, value, &self->renice);
}
} else if (strcmp(section, "custom") == 0) {
/* Custom subsection */
@ -413,3 +416,11 @@ void config_get_soft_realtime(GameModeConfig *self, char softrealtime[CONFIG_VAL
{
memcpy_locked_config(self, softrealtime, self->softrealtime, sizeof(self->softrealtime));
}
/*
* Get the renice value
*/
void config_get_renice_value(GameModeConfig *self, long *value)
{
memcpy_locked_config(self, value, &self->renice, sizeof(long));
}

View File

@ -108,3 +108,8 @@ void config_get_desired_governor(GameModeConfig *self, char governor[CONFIG_VALU
* Get the chosen soft realtime behavior
*/
void config_get_soft_realtime(GameModeConfig *self, char softrealtime[CONFIG_VALUE_MAX]);
/*
* Get the renice value
*/
void config_get_renice_value(GameModeConfig *self, long *value);

View File

@ -106,6 +106,10 @@ defaultgov=powersave
; force enable or disable with "on" or "off"
softrealtime=auto
; By default, GameMode renices the client to -4, you can put any value between 1 and 20 here,
; the value will be negated and applied as a nice value
renice = 4
[filter]
; If "whitelist" entry has a value(s)
; gamemode will reject anything not in the whitelist

View File

@ -11,6 +11,10 @@ defaultgov=powersave
; force enable or disable with "on" or "off"
softrealtime=auto
; By default, GameMode renices the client to -4, you can put any value between 1 and 20 here,
; the value will be negated and applied as a nice value
renice = 4
[filter]
; If "whitelist" entry has a value(s)
; gamemode will reject anything not in the whitelist