mmap/munmap /dev/zero
A message that is not in the archive (sent off-list or not yet received): 1024507315.757271291112523642.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com
PATCH v10 1/1 mmap/munmap /dev/zero
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.
---
v10: code cleanup
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 | 196 +++++++++++++++++++++++++++++++ 2 files changed, 201 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 +196 -0
196 lines not on this page · raw message
Signature · 1 line
1.7.1
From: CAI Qian <[email protected]>
Date: Tue, 30 Nov 2010 17:34:51 +0800
Subject: [PATCH v10] mmap/munmap /dev/zero
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.
---
v10: code cleanup
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 | 196 +++++++++++++++++++++++++++++++ 2 files changed, 201 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 +196 -0
196 lines not on this page · raw message
Signature · 1 line
1.7.1
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500! Tap into the largest installed PC base & get more eyes on your game by optimizing for Intel(R) Graphics Technology. Get started today with the Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list