This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] Allow shrinking of arena heaps using mmap based onovercommit settings when available


Hi,

Ping?

Regards,
Siddhesh

On Tue, 11 Sep 2012 15:40:36 +0530, Siddhesh wrote:

> Hi Roland,
> 
> Here is an updated patch with further fixes as per your review. No
> regressions in the testsuite. Also, I have tested this on F16 x86_64
> as follows:
> 
> * echo 0 > /proc/sys/vm/overcommit_memory
> * Run the benchmark program that I posted earlier:
> 
> http://sourceware.org/ml/libc-alpha/2012-08/msg00462.html
> 
> and attach an strace as follows:
> 
> strace -f -e madvise -p $(pgrep a.out)
> 
> to confirm that madvise is being called. Detach and attach strace
> again as follows:
> 
> strace -f -e mmap -p $(pgrep a.out)
> 
> to ensure that there are no mmap calls with MAP_FIXED.
> 
> Now disable overcommit:
> 
> * echo 2 > /proc/sys/vm/overcommit_memory
> * Run the benchmark program and verify that the behaviour is the
>   opposite, i.e. there should be no calls to madvise and you should
> see calls to mmap with MAP_FIXED.
> 
> Further, I also verified that I see the performance difference between
> madvise and MAP_FIXED:
> 
> with overcommit_memory == 0:
> 
> RUNS=4096, TOTAL=8859615.000000, AVG=2162.991943
> RUNS=4096, TOTAL=8948967.000000, AVG=2184.806396
> RUNS=4096, TOTAL=9002337.000000, AVG=2197.836182
> RUNS=4096, TOTAL=9147284.000000, AVG=2233.223633
> RUNS=4096, TOTAL=8852469.000000, AVG=2161.247314
> RUNS=4096, TOTAL=8920974.000000, AVG=2177.972168
> RUNS=4096, TOTAL=9051495.000000, AVG=2209.837646
> RUNS=4096, TOTAL=8896417.000000, AVG=2171.976807
> 
> with overcommit_memory == 2:
> 
> RUNS=4096, TOTAL=9916217.000000, AVG=2420.951416
> RUNS=4096, TOTAL=10098292.000000, AVG=2465.403320
> RUNS=4096, TOTAL=9951147.000000, AVG=2429.479248
> RUNS=4096, TOTAL=9776165.000000, AVG=2386.759033
> RUNS=4096, TOTAL=9735272.000000, AVG=2376.775391
> RUNS=4096, TOTAL=10049977.000000, AVG=2453.607666
> RUNS=4096, TOTAL=9967350.000000, AVG=2433.435059
> RUNS=4096, TOTAL=9817866.000000, AVG=2396.939941
> 
> Regards,
> Siddhesh
> 
> ChangeLog:
> 
> 	* malloc/arena.c: Include malloc-sysdep.h.
> 	(shrink_heap): Use check_may_shrink_heap to decide if madvise
> 	is sufficient to shrink the heap or an unmap is needed.
> 	* sysdeps/generic/malloc-sysdep.h: New file.  Define
> 	new function check_may_shrink_heap.
> 	* sysdeps/unix/sysv/linux/malloc-sysdep.h: New file.  Define
> 	new function check_may_shrink_heap.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]