Skip to contentSkip to conversation

mem/lib: Skip oom(KSM) if child_alloc() makes single TESTMEM+MB allocation

PATCH New Li Wang 2 participants 2 messages Jun 21, 2016

lore
Share & tools
lore

Li Wang

author
#0 lore raw

PATCH 1/1 mem/lib: Skip oom(KSM) if child_alloc() makes single TESTMEM+MB allocation

We occasionally catch errors like:

oom03       0  TINFO  :  start OOM testing for KSM pages.
oom03       0  TINFO  :  expected victim is 3490.
oom03       6  TFAIL  :  mem.c:163: victim unexpectedly ended with retcode: 0, expected: 12
oom03       0  TINFO  :  set overcommit_memory to 0

It cames from the caller testoom(0, 1, ENOMEM, 1). The issue was occurred since child_alloc() go into single(lite == 1) thread mode but successfully finish the memory(TESTMEM+MB) allocation and return 0. That's not what we expected because oom03 has already set 'limit_in_byte = TESTMEM' in cgroup. A probably reason is that KSM scan merged samepages and disturbed the OOM test.

By this patch, Let's skip the oom(KSM) test in cgroup.

---
 testcases/kernel/mem/lib/mem.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
testcases/kernel/mem/lib/mem.c +4 -2
index 3d853a3..10eb0f7 100644
@@ -224,8 +224,10 @@ void testoom(int mempolicy, int lite, int retcode, int allow_sigkill)
 	tst_resm(TINFO, "start OOM testing for mlocked pages.");
 	oom(MLOCK, lite, retcode, allow_sigkill);
 
-	if (access(PATH_KSM, F_OK) == -1) {
-		tst_resm(TINFO, "KSM configuration is not enabled, "
+	/* Skip oom(KSM) if lite == 1, since limit_in_bytes may vary from
+	 * run to run, which isn't reliable for oom03 cgroup test.*/
+	if (access(PATH_KSM, F_OK) == -1 || lite == 1) {
+		tst_resm(TINFO, "KSM is not configed or lite == 1, "
 			 "skip OOM test for KSM pags");
 	} else {
 		tst_resm(TINFO, "start OOM testing for KSM pages.");
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/1 mem/lib: Skip oom(KSM) if child_alloc() makes single TESTMEM+MB allocation

----- Original Message -----

Quoted 6 lines

From: "Li Wang" <[email protected]>
To: [email protected]
Cc: [email protected]
Sent: Tuesday, 21 June, 2016 12:54:43 PM
Subject: [PATCH] mem/lib: Skip oom(KSM) if child_alloc() makes single TESTMEM+MB allocation

I reworded the description a little and pushed.

Thanks,
Jan