Skip to contentSkip to conversation

lib/mem.c: exit from test_transparent_hugepage() if shortage of memory

PATCH New Li Wang 2 participants 6 messages Jan 26, 2016 – Feb 4, 2016

lore
Share & tools
lore

Li Wang

author
#0 lore raw

PATCH 1/1 lib/mem.c: exit from test_transparent_hugepage() if shortage of memory

Sometime thp05.c fails like:
---

thp05       0  TINFO  :  Stop all children...
thp05       0  TINFO  :  Start to scan all transparent hugepages...
thp05       0  TINFO  :  khugepaged daemon takes 10s to scan all thp pages
thp05       0  TINFO  :  Start to verify transparent hugepage size...
thp05       1  TFAIL  :  mem.c:754: child[27099] got 43008KB thps - expect 40960KB thps
thp05       2  TFAIL  :  mem.c:754: child[27099] got 43008KB thps - expect 40960KB thps
thp05       3  TFAIL  :  mem.c:754: child[27099] got 43008KB thps - expect 40960KB thps
thp05       4  TFAIL  :  mem.c:754: child[27099] got 43008KB thps - expect 40960KB thps

---

Since the system has done much testing work so far as it comes here, it is very easy to hit the fails if the memory is fragmented, the following tests should better be skiped while system dose not have enough memory for THP testing.

---
 testcases/kernel/mem/lib/mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/mem/lib/mem.c +1 -1
index cee4e91..6715c35 100644
@@ -773,7 +773,7 @@ void test_transparent_hugepage(int nr_children, int nr_thps,
 	memfree = read_meminfo("MemFree:");
 	tst_resm(TINFO, "The current MemFree is %luMB", memfree / KB);
 	if (memfree < MB)
-		tst_resm(TCONF, "Not enough memory for testing");
+		tst_brkm(TCONF, NULL, "Not enough memory for testing");
 
 	hugepagesize = read_meminfo("Hugepagesize:");
 	tst_resm(TINFO, "The current Hugepagesize is %luMB", hugepagesize / KB);
Signature · 1 line
1.8.3.1
author
#1 lore raw

PATCH 1/1 lib/mem.c: exit from test_transparent_hugepage() if shortage of memory

Hi,

seems this patch haven't totally fix the issue. after applying it, thp05.c still failed on 2 numa x86_64 system occasionally.

then I looked into the detail and found that the key point is the parameter which we set to the process is probably too large for some testing systems.

I'm trying to make thp05.c get 'nr_thps' values dynamically, but currently I don't have any goodidea. :(

------

$ cat ltp/runtest/mm |grep thp05
thp05_1 thp05
thp05_2 thp05 -n 10 -N 20
thp05_3 thp05 -n 1 -N 300    <-------

-------

# cat thp05.c
...
option_t thp_options[] = {
    {"n:", &opt_nr_children, &opt_nr_children_str},
    {"N:", &opt_nr_thps, &opt_nr_thps_str},
    {NULL, NULL, NULL}
};

static int pre_thp_scan_sleep_millisecs;
static int pre_thp_alloc_sleep_millisecs;
static char pre_thp_enabled[BUFSIZ];

int main(int argc, char *argv[])

{
    int lc;
    char *msg;
    int nr_children = 2, nr_thps = 64;   <-------

    tst_parse_opts(argc, argv, thp_options, thp_usage);

    check_thp_options(&nr_children, &nr_thps);

----
cmdline="thp05 -n 1 -N 300"
contacts=""
analysis=exit
<<<test_output>>>

thp05       0  TINFO  :  Start to test transparent hugepage...
thp05       0  TINFO  :  There are 1 children allocating 300 transparent
hugepages
thp05       0  TINFO  :  THP on MPOL_BIND mempolicy...
thp05       0  TINFO  :  The current MemFree is 8286MB
thp05       0  TINFO  :  child[61793] stop here
thp05       0  TINFO  :  Start to test transparent hugepage...
thp05       0  TINFO  :  There are 1 children allocating 300 transparent
hugepages
thp05       0  TINFO  :  THP on MPOL_BIND mempolicy...
thp05       0  TINFO  :  The current MemFree is 8286MB
thp05       0  TINFO  :  Stop all children...
thp05       0  TINFO  :  Start to scan all transparent hugepages...
thp05       0  TINFO  :  khugepaged daemon takes 15s to scan all thp pages
thp05       0  TINFO  :  Start to verify transparent hugepage size...
thp05       1  TFAIL  :  child[61792] got 561152KB thps - expect 614400KB
thps
thp05       0  TINFO  :  Wake up all children...
thp05       0  TINFO  :  THP on MPOL_INTERLEAVE mempolicy...
thp05       0  TINFO  :  The mempolicy need more than 2 numa nodes
thp05       0  TINFO  :  The current MemFree is 8287MB
thp05       0  TINFO  :  child[61914] stop here
thp05       0  TINFO  :  Start to test transparent hugepage...
thp05       0  TINFO  :  There are 1 children allocating 300 transparent
hugepages
thp05       0  TINFO  :  THP on MPOL_BIND mempolicy...
thp05       0  TINFO  :  The current MemFree is 8286MB
thp05       0  TINFO  :  Stop all children...
thp05       0  TINFO  :  Start to scan all transparent hugepages...
thp05       0  TINFO  :  khugepaged daemon takes 15s to scan all thp pages
thp05       0  TINFO  :  Start to verify transparent hugepage size...
thp05       1  TFAIL  :  child[61792] got 561152KB thps - expect 614400KB
thps
thp05       0  TINFO  :  Wake up all children...
thp05       0  TINFO  :  THP on MPOL_INTERLEAVE mempolicy...
thp05       0  TINFO  :  The mempolicy need more than 2 numa nodes
thp05       0  TINFO  :  The current MemFree is 8287MB
thp05       0  TINFO  :  Stop all children...
thp05       0  TINFO  :  Start to scan all transparent hugepages...
thp05       0  TINFO  :  khugepaged daemon takes 10s to scan all thp pages
thp05       0  TINFO  :  Start to verify transparent hugepage size...
thp05       2  TFAIL  :  child[61792] got 612352KB thps - expect 614400KB
thps
thp05       0  TINFO  :  Wake up all children...
thp05       0  TINFO  :  THP on MPOL_PREFERRED mempolicy...
thp05       0  TINFO  :  The mempolicy need more than 2 numa nodes
thp05       0  TINFO  :  The current MemFree is 8292MB
thp05       0  TINFO  :  child[62004] stop here
thp05       0  TINFO  :  Start to test transparent hugepage...
thp05       0  TINFO  :  There are 1 children allocating 300 transparent
hugepages
thp05       0  TINFO  :  THP on MPOL_BIND mempolicy...
thp05       0  TINFO  :  The current MemFree is 8286MB
thp05       0  TINFO  :  Stop all children...
thp05       0  TINFO  :  Start to scan all transparent hugepages...
thp05       0  TINFO  :  khugepaged daemon takes 15s to scan all thp pages
thp05       0  TINFO  :  Start to verify transparent hugepage size...
thp05       1  TFAIL  :  child[61792] got 561152KB thps - expect 614400KB
thps
thp05       0  TINFO  :  Wake up all children...
thp05       0  TINFO  :  THP on MPOL_INTERLEAVE mempolicy...
thp05       0  TINFO  :  The mempolicy need more than 2 numa nodes
thp05       0  TINFO  :  The current MemFree is 8287MB
thp05       0  TINFO  :  Stop all children...
thp05       0  TINFO  :  Start to scan all transparent hugepages...
thp05       0  TINFO  :  khugepaged daemon takes 10s to scan all thp pages
thp05       0  TINFO  :  Start to verify transparent hugepage size...
thp05       2  TFAIL  :  child[61792] got 612352KB thps - expect 614400KB
thps
thp05       0  TINFO  :  Wake up all children...
thp05       0  TINFO  :  THP on MPOL_PREFERRED mempolicy...
thp05       0  TINFO  :  The mempolicy need more than 2 numa nodes
thp05       0  TINFO  :  The current MemFree is 8292MB
thp05       0  TINFO  :  Stop all children...
thp05       0  TINFO  :  Start to scan all transparent hugepages...
thp05       0  TINFO  :  khugepaged daemon takes 10s to scan all thp pages
thp05       0  TINFO  :  Start to verify transparent hugepage size...
thp05       3  TFAIL  :  child[61792] got 610304KB thps - expect 614400KB

thps
thp05 0 TINFO : Wake up all children...

Quoted 50 lines · Li Wang

Sometime thp05.c fails like:
---

thp05       0  TINFO  :  Stop all children...
thp05       0  TINFO  :  Start to scan all transparent hugepages...
thp05       0  TINFO  :  khugepaged daemon takes 10s to scan all thp pages
thp05       0  TINFO  :  Start to verify transparent hugepage size...
thp05       1  TFAIL  :  mem.c:754: child[27099] got 43008KB thps - expect

40960KB thps
thp05 2 TFAIL : mem.c:754: child[27099] got 43008KB thps - expect
40960KB thps
thp05 3 TFAIL : mem.c:754: child[27099] got 43008KB thps - expect
40960KB thps
thp05 4 TFAIL : mem.c:754: child[27099] got 43008KB thps - expect
40960KB thps
---

Since the system has done much testing work so far as it comes here, it is very easy to
hit the fails if the memory is fragmented, the following tests should better be skiped
while system dose not have enough memory for THP testing.

---
 testcases/kernel/mem/lib/mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/mem/lib/mem.c +1 -1
index cee4e91..6715c35 100644
@@ -773,7 +773,7 @@ void test_transparent_hugepage(int nr_children, int
 nr_thps,
        memfree = read_meminfo("MemFree:");
        tst_resm(TINFO, "The current MemFree is %luMB", memfree / KB);
        if (memfree < MB)
-               tst_resm(TCONF, "Not enough memory for testing");
+               tst_brkm(TCONF, NULL, "Not enough memory for testing");
 
        hugepagesize = read_meminfo("Hugepagesize:");

tst_resm(TINFO, "The current Hugepagesize is %luMB", hugepagesize
/ KB);
--
1.8.3.1

--
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/20160126/e7f90c47/attachment-0001.html>
author
#2 lore raw

PATCH 1/1 lib/mem.c: exit from test_transparent_hugepage() if shortage of memory

Hi,

I recall a similar testcase thp04.c which had been removed not long ago,

    commit 19cdd120b43aa6a6a4993b61e6ef675d1cdf04b4

after read the words written by Michal Ho, and I found these two (thp04/05) cases are facing with very similar issue.

now I doubt if we can really trust thp05 result PASS/FAIL for LTP, remove it or keep using(just reducing the nr_thps value)?

http://article.gmane.org/gmane.linux.ltp/23104

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

PATCH 1/1 lib/mem.c: exit from test_transparent_hugepage() if shortage of memory

Hi!

Quoted 10 lines

I recall a similar testcase thp04.c which had been removed not long ago,

    commit 19cdd120b43aa6a6a4993b61e6ef675d1cdf04b4

after read the words written by Michal Ho, and I found these two (thp04/05) cases are facing with very similar issue.

now I doubt if we can really trust thp05 result PASS/FAIL for LTP, remove it or keep using(just reducing the nr_thps value)?

http://article.gmane.org/gmane.linux.ltp/23104

The test is indeed nearly the same as thp04 and it suffers the same problem as thp04. Let's remove it (along with the functions from testcases/kernel/mem/lib/mem.c that would be unused after the removal.

Signature · 2 lines
Cyril Hrubis
[email protected]
#4 lore raw

PATCH 1/1 lib/mem.c: exit from test_transparent_hugepage() if shortage of memory

In reply to Li Wang

Hi!

Quoted 10 lines

Sometime thp05.c fails like:
---

thp05       0  TINFO  :  Stop all children...
thp05       0  TINFO  :  Start to scan all transparent hugepages...
thp05       0  TINFO  :  khugepaged daemon takes 10s to scan all thp pages
thp05       0  TINFO  :  Start to verify transparent hugepage size...
thp05       1  TFAIL  :  mem.c:754: child[27099] got 43008KB thps - expect 40960KB thps
thp05       2  TFAIL  :  mem.c:754: child[27099] got 43008KB thps - expect 40960KB thps
thp05       3  TFAIL  :  mem.c:754: child[27099] got 43008KB thps - expect 40960KB thps
thp05       4  TFAIL  :  mem.c:754: child[27099] got 43008KB thps - expect 40960KB thps

Hmm shouldn't the TCONF message be included in the output here? (otherwise the if wasn't triggered at all)

Quoted 16 lines

---

Since the system has done much testing work so far as it comes here, it is very easy to hit the fails if the memory is fragmented, the following tests should better be skiped while system dose not have enough memory for THP testing.

---
 testcases/kernel/mem/lib/mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/mem/lib/mem.c +0 -0
index cee4e91..6715c35 100644

testcases/kernel/mem/lib/mem.c void test_transparent_hugepage(int nr_children, int nr_thps, · line 776

Quoted 5 lines
testcases/kernel/mem/lib/mem.c +1 -1
@@ -773,7 +773,7 @@ void test_transparent_hugepage(int nr_children, int nr_thps,
 	memfree = read_meminfo("MemFree:");
 	tst_resm(TINFO, "The current MemFree is %luMB", memfree / KB);
 	if (memfree < MB)
-		tst_resm(TCONF, "Not enough memory for testing");
+		tst_brkm(TCONF, NULL, "Not enough memory for testing");

This looks like obvious typo, but we should pass the cleanup to the tst_brkm() here as the rest of the tst_brkm() in this fuction does.

Quoted 2 lines
testcases/kernel/mem/lib/mem.c +0 -0
 	hugepagesize = read_meminfo("Hugepagesize:");
 	tst_resm(TINFO, "The current Hugepagesize is %luMB", hugepagesize / KB);
Signature · 2 lines
Cyril Hrubis
[email protected]
author
#5 lore raw

PATCH 1/1 lib/mem.c: exit from test_transparent_hugepage() if shortage of memory

Hi,

thanks for quick response.

Quoted 11 lines · Cyril Hrubis

Hi!

Quoted 5 lines

Sometime thp05.c fails like:
---

thp05       0  TINFO  :  Stop all children...
thp05       0  TINFO  :  Start to scan all transparent hugepages...
thp05       0  TINFO  :  khugepaged daemon takes 10s to scan all thp

pages

Quoted 2 lines
thp05       0  TINFO  :  Start to verify transparent hugepage size...
thp05       1  TFAIL  :  mem.c:754: child[27099] got 43008KB thps -

expect 40960KB thps

Quoted 1 line

thp05 2 TFAIL : mem.c:754: child[27099] got 43008KB thps -

Quoted 9 lines

expect 40960KB thps

Quoted 1 line

thp05 3 TFAIL : mem.c:754: child[27099] got 43008KB thps -

expect 40960KB thps

Quoted 1 line

thp05 4 TFAIL : mem.c:754: child[27099] got 43008KB thps -

expect 40960KB thps

Hmm shouldn't the TCONF message be included in the output here? (otherwise the if wasn't triggered at all)

yes, it should be triggered first and then print the msg here.

I have realized the TFAIL problem is not simple like that, and I had already added some comments in the following maillist. Hope you could take a consideration when you get a chance.

Of course I'm ok if this issue couldn't be solved in the next LTP released, since the time is short.

Quoted 37 lines
Quoted 3 lines

---

Since the system has done much testing work so far as it comes here, it

is very easy to

Quoted 1 line

hit the fails if the memory is fragmented, the following tests should

better be skiped

Review

Quoted 8 lines

while system dose not have enough memory for THP testing.

---
 testcases/kernel/mem/lib/mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/testcases/kernel/mem/lib/mem.c

testcases/kernel/mem/lib/mem.c void test_transparent_hugepage(int nr_children, int

Quoted 4 lines

index cee4e91..6715c35 100644

testcases/kernel/mem/lib/mem.c +0 -0
@@ -773,7 +773,7 @@ void test_transparent_hugepage(int nr_children, int

nr_thps,

testcases/kernel/mem/lib/mem.c void test_transparent_hugepage(int nr_children, int nr_thps, · line 776

Quoted 5 lines
testcases/kernel/mem/lib/mem.c +1 -1
      memfree = read_meminfo("MemFree:");
      tst_resm(TINFO, "The current MemFree is %luMB", memfree / KB);
      if (memfree < MB)
-             tst_resm(TCONF, "Not enough memory for testing");
+             tst_brkm(TCONF, NULL, "Not enough memory for testing");

This looks like obvious typo, but we should pass the cleanup to the tst_brkm() here as the rest of the tst_brkm() in this fuction does.

testcases/kernel/mem/lib/mem.c void test_transparent_hugepage(int nr_children, int · line 778

Quoted 2 lines
testcases/kernel/mem/lib/mem.c +0 -0
      hugepagesize = read_meminfo("Hugepagesize:");
      tst_resm(TINFO, "The current Hugepagesize is %luMB", hugepagesize

/ KB);

--
Cyril Hrubis
[email protected]

Signature · 6 lines
Regards,
Li Wang
Email: [email protected]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20160126/134ab769/attachment.html>