This way the igt test will always be killed first (hopefully),
preventing mayhem when one of the memory thrashing tests treatens to
take down the entire system.
To avoid any burden on test writers we adjust the oom score on
drm_open, any of the fork helpers and subtest init. That should cover
everything.
v2: Fix it up.
Cc: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
return -1;
}
+static void oom_adjust_for_doom(void)
+{
+ int fd;
+ const char always_kill[] = "1000";
+
+ fd = open("/proc/self/oom_score_adj", O_WRONLY);
+ igt_assert(fd != -1);
+ igt_assert(write(fd, always_kill, sizeof(always_kill)) == sizeof(always_kill));
+}
+
/** Open the first DRM device we can find, searching up to 16 device nodes */
static int __drm_open_any(void)
{
fd = -1;
}
+ oom_adjust_for_doom();
+
return fd;
}
return fd;
}
+ oom_adjust_for_doom();
+
return fd;
}
}
igt_install_exit_handler(check_igt_exit);
+ oom_adjust_for_doom();
out:
return ret;
case 0:
exit_handler_count = 0;
reset_helper_process_list();
+ oom_adjust_for_doom();
return true;
default:
test_child = true;
exit_handler_count = 0;
reset_helper_process_list();
+ oom_adjust_for_doom();
return true;
default: