Set up for resetting niceness value

Add tests to check this feature
	Apply config validation in config for simplicity

	Note: if anything messes with the niceness (ie. it starts non-zero, or it's not the expected value during setup, we'll bail out)
This commit is contained in:
Marc Di Luzio
2019-05-11 10:33:29 +01:00
parent 7e5216c4a0
commit 09d63ae4f5
5 changed files with 118 additions and 17 deletions

View File

@@ -71,6 +71,8 @@ struct GameModeContext {
struct GameModeGPUInfo *stored_gpu; /**<Stored GPU info for the current GPU */
struct GameModeGPUInfo *target_gpu; /**<Target GPU info for the current GPU */
int initial_renice; /**<Initial renice value */
/* Reaper control */
struct {
pthread_t thread;
@@ -412,8 +414,11 @@ int game_mode_context_register(GameModeContext *self, pid_t client, pid_t reques
game_mode_context_enter(self);
}
/* Store current renice and apply */
self->initial_renice = game_mode_get_renice(client);
game_mode_apply_renice(self, client, 0 /* expect zero value to start with */);
/* Apply scheduler policies */
game_mode_apply_renice(self, client);
game_mode_apply_scheduling(self, client);
/* Apply io priorities */