diff options
author | Petri Latvala <petri.latvala@intel.com> | 2019-04-11 12:40:12 +0300 |
---|---|---|
committer | Petri Latvala <petri.latvala@intel.com> | 2019-04-12 12:09:02 +0300 |
commit | a52cc643cfe6733465cfc9ccb3d21cbdc4fd7506 (patch) | |
tree | 03287c974f49614a6faad9270e4caee05359aa81 /runner | |
parent | e26b3caa766a499891d4a56d54150d68ca8fa3f5 (diff) | |
download | platform_external_igt-gpu-tools-a52cc643cfe6733465cfc9ccb3d21cbdc4fd7506.tar.gz platform_external_igt-gpu-tools-a52cc643cfe6733465cfc9ccb3d21cbdc4fd7506.tar.bz2 platform_external_igt-gpu-tools-a52cc643cfe6733465cfc9ccb3d21cbdc4fd7506.zip |
runner: Make sure oom-killer doesn't kill the runner
Tests that eat all of the RAM and then some to invoke the oom-killer
deliberately sometimes cause extra casualties. Make sure the runner
stays alive.
Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'runner')
-rw-r--r-- | runner/executor.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/runner/executor.c b/runner/executor.c index 0e91b7ab..7e5fbe8f 100644 --- a/runner/executor.c +++ b/runner/executor.c @@ -1221,6 +1221,22 @@ static void write_abort_file(int resdirfd, } } +static void oom_immortal(void) +{ + int fd; + const char never_kill[] = "-1000"; + + fd = open("/proc/self/oom_score_adj", O_WRONLY); + if (fd < 0) { + fprintf(stderr, "Warning: Cannot adjust oom score.\n"); + return; + } + if (write(fd, never_kill, sizeof(never_kill)) != sizeof(never_kill)) + fprintf(stderr, "Warning: Adjusting oom score failed.\n"); + + close(fd); +} + bool execute(struct execute_state *state, struct settings *settings, struct job_list *job_list) @@ -1268,6 +1284,8 @@ bool execute(struct execute_state *state, close(timefd); } + oom_immortal(); + init_watchdogs(settings); if (!uname(&unamebuf)) { |