mmap/munmap /dev/zero: a common way of malloc()/free() anonymous memory on Solaris
A message that is not in the archive (sent off-list or not yet received): 1222818984.1813081289198905327.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com
PATCH v9 1/1 mmap/munmap /dev/zero: a common way of malloc()/free() anonymous memory on Solaris
The basic purpose of this is a to test if it is possible to map and unmap /dev/zero, and to read and write the mapping. Being inspired by two bugs in the past, the design of the test was added some variations based on the reproducers for them. It also accept an option to mmap/munmap anonymous pages.
One is to trigger panic with transparent hugepage feature that split_huge_page is very strict in checking the rmap walk was perfect. Keep it strict because if page_mapcount isn't stable and just right, the __split_huge_page_refcount that follows the rmap walk could lead to erratic page_count()s for the subpages. The bug in fork lead to the rmap walk finding the parent huge-pmd twice instead of just one, because the anon_vma_chain objects of the child vma still point to the vma->vm_mm of the parent. That trips on the split_huge_page mapcount vs page_mapcount check leading to a BUG_ON.
The other bug is mmap() of /dev/zero results in calling map_zero() which on RHEL5 maps the ZERO_PAGE in every PTE within that virtual address range. Since the application which maps a region from 5M to 16M in size is also multi-threaded the subsequent munmap() of /dev/zero results is TLB shootdowns to all other CPUs. When this happens thousands or millions of times the application performance is terrible. The mapping ZERO_PAGE in every pte within that virtual address range was an optimization to make the subsequent pagefault times faster on RHEL5 that has been removed/changed upstream.
---
v9: add the tests to runtest/mm.
v8: add an option to utilize KSM; no need to open /dev/zero for
anonymous page testing.
v7: another "(void)" fix
v6: really use git format; check return from children; cleanup.
v5: add an option to test anonymous pages; move open() into setup().
v4: comment fix; code cleanup.
v3: really mmap /dev/zero; replace _exit() with exit(); fix patch
format.
v2: incorporate comments from Mike and Garrett.
runtest/mm | 5 + testcases/kernel/syscalls/mmap/mmap10.c | 204 +++++++++++++++++++++++++++++++ 2 files changed, 209 insertions(+), 0 deletions(-) create mode 100644 testcases/kernel/syscalls/mmap/mmap10.c
runtest/mm +5 -0
@@ -54,3 +54,8 @@ mmapstress08 mmapstress08 mmapstress09 mmapstress09 -p 20 -t 0.2 mmapstress10 mmapstress10 -p 20 -t 0.2 +mmap10 mmap10 +mmap10_1 mmap10 -a +mmap10_2 mmap10 -s +mmap10_3 mmap10 -a -s +mmap10_4 mmap10 -a -s -c 60
testcases/kernel/syscalls/mmap/mmap10.c new file +204 -0
204 lines not on this page · raw message
Signature · 1 line
1.7.1
------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book "Blueprint to a Billion" shares his insights and actions to help propel your business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list