Skip to contentSkip to conversation

lib/igt_core.c : only disable low mem killer once

PATCH Superseded [email protected] 2 participants 2 messages Apr 24, 2015 Library code

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/igt_core.c : only disable low mem killer once

From: Tim Gore <[email protected]>

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.

---
 lib/igt_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/igt_core.c +1 -1
index 7d04f2c..fec4893 100644
@@ -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 */
Signature · 6 lines
2.3.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 8 lines · On 24 April 2015 at 14:43, <[email protected]> wrote:

From: Tim Gore <[email protected]>

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.

Quoted 27 lines
---
 lib/igt_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/igt_core.c +1 -2
index 7d04f2c..fec4893 100644
@@ -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 */
--
Quoted 2 lines

2.3.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx