Skip to contentSkip to conversation

mem/oom: do cleanup work for oom0{3,4,5}

PATCH New Li Wang 2 participants 3 messages Jan 29, 2016 – Feb 19, 2016

lore
Share & tools
lore

Li Wang

author
#0 lore raw

PATCH 1/1 mem/oom: do cleanup work for oom0{3,4,5}

oom03 should not test on aarch64 system which does not support NUMA, so I add the function to make sure it could be skiped.
-----

  # ./oom03
  oom03       0  TINFO  :  set overcommit_memory to 1
  ...
  oom03       0  TINFO  :  expected victim is 29154.
  oom03       6  TPASS  :  victim signalled: (9) SIGKILL
  oom03       7  TCONF  :  numa_helper.c:86: syscall(236) __NR_get_mempolicy not supported on your arch
  oom03       8  TCONF  :  numa_helper.c:86: Remaining cases not appropriate for configuration

oom0{4,5} get fails on aarch64 system if run it in continuous twice(the first time skiped with TCONF, then the second time it will be failed).
-----

  # ./oom05
  oom05       0  TINFO  :  set overcommit_memory to 1
  oom05       1  TCONF  :  numa_helper.c:86: syscall(236) __NR_get_mempolicy not supported on your arch
  oom05       2  TCONF  :  numa_helper.c:86: Remaining cases not appropriate for configuration
  # ./oom05
  oom05       0  TINFO  :  set overcommit_memory to 1
  oom05       1  TBROK  :  mem.c:997: mkdir /dev/cgroup: errno=EEXIST(17): File exists
  oom05       2  TBROK  :  mem.c:997: Remaining cases broken
  oom05       0  TINFO  :  set overcommit_memory to 1

the reason is that it doesn't pass the cleanup to the tst_brkm() there.

-----

---
 testcases/kernel/mem/oom/oom03.c | 3 +++
 testcases/kernel/mem/oom/oom04.c | 2 +-
 testcases/kernel/mem/oom/oom05.c | 2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)
testcases/kernel/mem/oom/oom03.c +3 -0
index 3afc3de..eabaeb9 100644
@@ -94,6 +94,9 @@ void setup(void)
 	tst_sig(FORK, DEF_HANDLER, cleanup);
 	TEST_PAUSE;
 
+	if (!is_numa(NULL))
+		tst_brkm(TCONF, NULL, "The case need a NUMA system.");
+
 	overcommit = get_sys_tune("overcommit_memory");
 	set_sys_tune("overcommit_memory", 1, 1);
 	mount_mem("memcg", "cgroup", "memory", MEMCG_PATH, MEMCG_PATH_NEW);
testcases/kernel/mem/oom/oom04.c +1 -1
index ffb5503..0a315e1 100644
@@ -100,7 +100,7 @@ void setup(void)
 	 */
 	ret = get_allowed_nodes(NH_MEMS, 1, &memnode);
 	if (ret < 0)
-		tst_brkm(TBROK, NULL, "Failed to get a memory node "
+		tst_brkm(TBROK, cleanup, "Failed to get a memory node "
 				      "using get_allowed_nodes()");
 	write_cpusets(memnode);
 }
testcases/kernel/mem/oom/oom05.c +1 -1
index 9cd49a7..44a243e 100644
@@ -125,7 +125,7 @@ void setup(void)
 	 */
 	ret = get_allowed_nodes(NH_MEMS, 1, &memnode);
 	if (ret < 0)
-		tst_brkm(TBROK, NULL, "Failed to get a memory node "
+		tst_brkm(TBROK, cleanup, "Failed to get a memory node "
 				      "using get_allowed_nodes()");
 	write_cpusets(memnode);
 }
Signature · 1 line
1.9.3
author
#1 lore raw

PATCH 1/1 mem/oom: do cleanup work for oom0{3,4,5}

sorry, ping~

Quoted 91 lines · Li Wang

oom03 should not test on aarch64 system which does not support NUMA, so I add
the function to make sure it could be skiped.
-----

  # ./oom03
  oom03       0  TINFO  :  set overcommit_memory to 1
  ...
  oom03       0  TINFO  :  expected victim is 29154.
  oom03       6  TPASS  :  victim signalled: (9) SIGKILL
  oom03       7  TCONF  :  numa_helper.c:86: syscall(236)
__NR_get_mempolicy not supported on your arch
  oom03       8  TCONF  :  numa_helper.c:86: Remaining cases not
appropriate for configuration

oom0{4,5} get fails on aarch64 system if run it in continuous twice(the first time skiped with TCONF, then the second time it will be failed).
-----

  # ./oom05
  oom05       0  TINFO  :  set overcommit_memory to 1
  oom05       1  TCONF  :  numa_helper.c:86: syscall(236)
__NR_get_mempolicy not supported on your arch
  oom05       2  TCONF  :  numa_helper.c:86: Remaining cases not
appropriate for configuration
  # ./oom05
  oom05       0  TINFO  :  set overcommit_memory to 1
  oom05       1  TBROK  :  mem.c:997: mkdir /dev/cgroup: errno=EEXIST(17):
File exists
  oom05       2  TBROK  :  mem.c:997: Remaining cases broken
  oom05       0  TINFO  :  set overcommit_memory to 1

the reason is that it doesn't pass the cleanup to the tst_brkm() there.

-----

---
 testcases/kernel/mem/oom/oom03.c | 3 +++
 testcases/kernel/mem/oom/oom04.c | 2 +-
 testcases/kernel/mem/oom/oom05.c | 2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)
testcases/kernel/mem/oom/oom03.c +3 -0
index 3afc3de..eabaeb9 100644
@@ -94,6 +94,9 @@ void setup(void)
        tst_sig(FORK, DEF_HANDLER, cleanup);
        TEST_PAUSE;
 
+       if (!is_numa(NULL))
+               tst_brkm(TCONF, NULL, "The case need a NUMA system.");
+
        overcommit = get_sys_tune("overcommit_memory");
        set_sys_tune("overcommit_memory", 1, 1);
        mount_mem("memcg", "cgroup", "memory", MEMCG_PATH, MEMCG_PATH_NEW);
testcases/kernel/mem/oom/oom04.c +1 -1
index ffb5503..0a315e1 100644
@@ -100,7 +100,7 @@ void setup(void)
         */
        ret = get_allowed_nodes(NH_MEMS, 1, &memnode);
        if (ret < 0)
-               tst_brkm(TBROK, NULL, "Failed to get a memory node "
+               tst_brkm(TBROK, cleanup, "Failed to get a memory node "
                                      "using get_allowed_nodes()");
        write_cpusets(memnode);
 }
testcases/kernel/mem/oom/oom05.c +1 -2
index 9cd49a7..44a243e 100644
@@ -125,7 +125,7 @@ void setup(void)
         */
        ret = get_allowed_nodes(NH_MEMS, 1, &memnode);
        if (ret < 0)
-               tst_brkm(TBROK, NULL, "Failed to get a memory node "
+               tst_brkm(TBROK, cleanup, "Failed to get a memory node "
                                      "using get_allowed_nodes()");
        write_cpusets(memnode);
 }
--

1.9.3

--
Mailing list info: http://lists.linux.it/listinfo/ltp

Signature · 6 lines
Regards,
Li Wang
Email: [email protected]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20160217/b5ca4fd8/attachment.html>
#2 lore raw

PATCH 1/1 mem/oom: do cleanup work for oom0{3,4,5}

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

Quoted 39 lines

From: "Li Wang" <[email protected]>
To: [email protected]
Sent: Wednesday, 17 February, 2016 2:51:09 AM
Subject: Re: [LTP] [PATCH] mem/oom: do cleanup work for oom0{3,4,5}

sorry, ping~

On Fri, Jan 29, 2016 at 9:36 PM, Li Wang < [email protected] > wrote:

oom03 should not test on aarch64 system which does not support NUMA, so I add the function to make sure it could be skiped.
-----

# ./oom03
oom03 0 TINFO : set overcommit_memory to 1
...
oom03 0 TINFO : expected victim is 29154.
oom03 6 TPASS : victim signalled: (9) SIGKILL
oom03 7 TCONF : numa_helper.c:86: syscall(236) __NR_get_mempolicy not
supported on your arch
oom03 8 TCONF : numa_helper.c:86: Remaining cases not appropriate for
configuration

oom0{4,5} get fails on aarch64 system if run it in continuous twice(the first time skiped with TCONF, then the second time it will be failed).
-----

# ./oom05
oom05 0 TINFO : set overcommit_memory to 1
oom05 1 TCONF : numa_helper.c:86: syscall(236) __NR_get_mempolicy not
supported on your arch
oom05 2 TCONF : numa_helper.c:86: Remaining cases not appropriate for
configuration
# ./oom05
oom05 0 TINFO : set overcommit_memory to 1
oom05 1 TBROK : mem.c:997: mkdir /dev/cgroup: errno=EEXIST(17): File exists
oom05 2 TBROK : mem.c:997: Remaining cases broken
oom05 0 TINFO : set overcommit_memory to 1
Quoted 3 lines

the reason is that it doesn't pass the cleanup to the tst_brkm() there.

Li,

I pushed the part for oom04 and oom05.

As for oom03 changes, these should go in separately, because it's not about cleanup.

Can you explain why first testoom() call on line 65 can't run on aarch64? There doesn't seem to be anything NUMA specific.

It seems to me your problem is that is_numa() causes TCONF, which it shouldn't. So, I'm thinking we should fix that:

testcases/kernel/lib/numa_helper.c +10 -2
index 0074180991ec..91214fcd85d9 100644
@@ -76,14 +76,22 @@ static int filter_nodemask_mem(nodemask_t * nodemask, unsigned long max_node)
 {
 #if MPOL_F_MEMS_ALLOWED
        unsigned long nodemask_size = max_node / 8;
+       int ret;
+
        memset(nodemask, 0, nodemask_size);
        /*
         * avoid numa_get_mems_allowed(), because of bug in getpol()
         * utility function in older versions:
         * http://www.spinics.net/lists/linux-numa/msg00849.html
         */
-       if (ltp_syscall(__NR_get_mempolicy, NULL, nodemask->n,
-                   max_node, 0, MPOL_F_MEMS_ALLOWED) < 0)
+       ret = syscall(__NR_get_mempolicy, NULL, nodemask->n,
+                   max_node, 0, MPOL_F_MEMS_ALLOWED);
+       /*
+        * If we don't have __NR_get_mempolicy assume we can use all
+        * present nodes. It is likely this is a system, that doesn't
+        * support NUMA and there's just 1 node.
+        */
+       if (ret < 0 && errno != ENOSYS)
                return -2;
 #else
        int i;

I'll look into trying this patch on aarch64 with oom03.

Regards,
Jan