On 02/13/2012 02:18 PM, Zhouping Liu wrote: > > The program is designed to test max_map_count tunable file > > The kernel Documentation say that: > /proc/sys/vm/max_map_count contains the maximum number of memory map > areas a process may have. Memory map areas are used as a side-effect > of calling malloc, directly by mmap and mprotect, and also when > loading shared libraries. > > Each process has his own maps file: /proc/[pid]/maps, and each line > indicates a map entry, so it can caculate the amount of maps by reading > the file lines' number to check the tunable performance. > > The program trys to invoke mmap() endless until triggering MAP_FAILED, > then read the process's maps file /proc/[pid]/maps, save the line number > to map_count variable, and compare it with /proc/sys/vm/max_map_count, > map_count should less than max_map_count. > Note: There are two special vmas VDSO and VSYSCALL, which are allocated > via install_special_mapping(), install_specail_mapping() allows the VMAs > to be allocated and inserted without checking the sysctl_map_map_count, > and each /proc/<pid>/maps has both at the end: > ... > ... > 7fff7b9ff000-7fff7ba00000 r-xp 00000000 00:00 0 [vdso] > ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] > > so during comparing with map_count and /proc/sys/vm/max_map_count, > we should except the two special vmas from map_count: > map_count -= 2; > > While most applications need less than a thousand maps, and the tunable > default value is 65530. > When the value is too large or too little, the system would hang, so I > choose four special value to test, which can coverage most situation: > a) Default value / 100 > b) Default value / 10 > c) Default value > d) Default value * 10 > > Signed-off-by: Zhouping Liu <[email protected]> > --- > runtest/mm | 2 + > testcases/kernel/mem/tunable/max_map_count.c | 197 > ++++++++++++++++++++++++++ > 2 files changed, 199 insertions(+), 0 deletions(-) > create mode 100644 testcases/kernel/mem/tunable/max_map_count.c >
Acked-by: Caspar Zhang <[email protected]> ------------------------------------------------------------------------------ Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
