Ltp-list:
Description: Base ltp
testcase
max_map_count is failing on ppc arch
kernel: 3.10.0-123.9.3
Here is the proposed patch to be
submitted
upstream:
Patch:
---
ltp-full-20140828.orig/testcases/kernel/mem/tunable/max_map_count.c
2014-11-11 11:13:39.811776626 -0600
+++ ltp-full-20140828/testcases/kernel/mem/tunable/max_map_count.c
2014-11-11 11:14:05.650945873 -0600
@@ -231,7 +231,7 @@ static void max_map_count_test(void)
* is the mm failure point at the time
of
* writing this COMMENT!
*/
- if (map_count == (max_maps + 1))
+ if (map_count <= (max_maps + 1))
tst_resm(TPASS, "%ld map
entries in total "
"as
expected.", max_maps);
else
Although according to the description of the test case
"map_count
<= max_map_count" is valid, it is implemented as "map_count
== (max_map_count + 1)" in the code.
We can say that the test case can be passed for "map_count <=
(max_map_count
+ 1)" because, MAP_FAILED can be triggered NOT ONLY when
max_map_count
is reached, but also when the kernel is running out of memory. IN
THIS
TESTCASE KERNEL RUNS OUT OF MEMORY BECAUSE THE PAGE SIZE IS HUGE.
Kernel allocates mapped area for each process, as entered in the
file /proc/[pid]/maps,
as multiples of pagesize.
Hence when the page size is huge, the kernel runs out of memory
(aligned
addresses in this case) even before max_map_count is reached.
Please find below test results suggesting that it is because of
the big
page size that MAP_FAILED is triggered.
Note that the amount of free memory is almost the same on both the
systems.
IA32:
kernel: 3.10.0-123.9.3
# getconf PAGESIZE
4096
# free -g
total used free
shared buffers cached
Mem:
23 1
22 0 0
0
-/+ buffers/cache:
0 22
Swap:
0 0
0
# cat /proc/sys/vm/max_map_count
65530
# ./max_map_count
max_map_count 0 TINFO
: set overcommit_memory to 2
max_map_count 0 TINFO
: set max_map_count to 64
max_map_count 1 TPASS
: 64 map entries in total as expected.
max_map_count 0 TINFO
: set max_map_count to 256
max_map_count 2 TPASS
: 256 map entries in total as expected.
max_map_count 0 TINFO
: set max_map_count to 1024
max_map_count 3 TPASS
: 1024 map entries in total as expected.
max_map_count 0 TINFO
: set max_map_count to 4096
max_map_count 4 TPASS
: 4096 map entries in total as expected.
max_map_count 0 TINFO
: set max_map_count to 16384
max_map_count 5 TPASS
: 16384 map entries in total as expected.
max_map_count 0 TINFO
: set max_map_count to 65536
max_map_count 6 TPASS
: 65536 map entries in total as expected.
max_map_count 0 TINFO
: set overcommit_memory to 0
max_map_count 0 TINFO
: set max_map_count to 65530
PPC:
kernel: 3.10.0-123.9.3
-bash-4.2# getconf PAGESIZE
65536
-bash-4.2# free -g
total used free
shared buffers cached
Mem:
19 0
18 0 0
0
-/+ buffers/cache:
0 19
Swap:
7 0
7
-bash-4.2# cat
/proc/sys/vm/max_map_count
65530
-bash-4.2# cd
/opt/fiv/ltp/testcases/bin/
-bash-4.2# ./max_map_count
max_map_count 0 TINFO
: set overcommit_memory to 2
max_map_count 0 TINFO
: set max_map_count to 64
max_map_count 1 TPASS
: 64 map entries in total as expected.
max_map_count 0 TINFO
: set max_map_count to 256
max_map_count 2 TPASS
: 256 map entries in total as expected.
max_map_count 0 TINFO
: set max_map_count to 1024
max_map_count 3 TPASS
: 1024 map entries in total as expected.
max_map_count 0 TINFO
: set max_map_count to 4096
max_map_count 4 TPASS
: 4096 map entries in total as expected.
max_map_count 0 TINFO
: set max_map_count to 16384
max_map_count 5 TPASS
: 16384 map entries in total as expected.
max_map_count 0 TINFO
: set max_map_count to 65536
max_map_count 6 TFAIL
: max_map_count.c:239: 65489 map entries in total, but expected
65536 entries
max_map_count 0 TINFO
: set overcommit_memory to 0
max_map_count 0 TINFO
: set max_map_count to 65530
After the patch is applied, the
test
passes:
-bash-4.2# ./max_map_count
max_map_count 0 TINFO
: set overcommit_memory to 2
max_map_count 0 TINFO
: set max_map_count to 64
max_map_count 1 TPASS
: 64 map entries in total as expected.
max_map_count 0 TINFO
: set max_map_count to 256
max_map_count 2 TPASS
: 256 map entries in total as expected.
max_map_count 0 TINFO
: set max_map_count to 1024
max_map_count 3 TPASS
: 1024 map entries in total as expected.
max_map_count 0 TINFO
: set max_map_count to 4096
max_map_count 4 TPASS
: 4096 map entries in total as expected.
max_map_count 0 TINFO
: set max_map_count to 16384
max_map_count 5 TPASS
: 16384 map entries in total as expected.
max_map_count 0 TINFO
: set max_map_count to 65536
max_map_count 6 TPASS
: 65536 map entries in total as expected.
max_map_count 0 TINFO
: set overcommit_memory to 0
max_map_count 0 TINFO
: set max_map_count to 65530
***************************
Meenakshi Sripal
Linux Technology Center - Embedded Linux