Message ID | 1429883019-32248-1-git-send-email-tim.gore@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 24 April 2015 at 14:43, <tim.gore@intel.com> wrote: > From: Tim Gore <tim.gore@intel.com> > > The call to low_mem_killer_disable(true) was being done > from within function oom_adjust_for_doom. However, > oom_adjust_for_doom gets called from 3 places. We only > want the call to low_mem_killer_disable(true) to happen > during common_init, so call it from here instead of from > oom_adjust_for_doom. I guess the reason you only want to call it once is because otherwise restoring the previous values won't work? I think low_mem_killer_disable needs some more protection against being called unexpectedly. At the moment, it is always called from common_exit_handler to restore the previous values, but when listing subtests the initial call to low_mem_killer_disable is skipped, which means the uninitialised value of prev_adj_scores will be written to the sysfs file. > > Signed-off-by: Tim Gore <tim.gore@intel.com> > --- > lib/igt_core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/igt_core.c b/lib/igt_core.c > index 7d04f2c..fec4893 100644 > --- a/lib/igt_core.c > +++ b/lib/igt_core.c > @@ -490,7 +490,6 @@ static void oom_adjust_for_doom(void) > igt_assert(write(fd, always_kill, sizeof(always_kill)) == sizeof(always_kill)); > close(fd); > > - low_mem_killer_disable(true); > } > > static int common_init(int *argc, char **argv, > @@ -653,6 +652,7 @@ out: > print_version(); > > oom_adjust_for_doom(); > + low_mem_killer_disable(true); > } > > /* install exit handler, to ensure we clean up */ > -- > 2.3.0 >
diff --git a/lib/igt_core.c b/lib/igt_core.c index 7d04f2c..fec4893 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -490,7 +490,6 @@ static void oom_adjust_for_doom(void) igt_assert(write(fd, always_kill, sizeof(always_kill)) == sizeof(always_kill)); close(fd); - low_mem_killer_disable(true); } static int common_init(int *argc, char **argv, @@ -653,6 +652,7 @@ out: print_version(); oom_adjust_for_doom(); + low_mem_killer_disable(true); } /* install exit handler, to ensure we clean up */