This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Ping[2]: [PATCH v2] Allow shrinking of arena heaps using mmap basedon overcommit settings when available
- From: Siddhesh Poyarekar <siddhesh at redhat dot com>
- To: libc-alpha at sourceware dot org
- Cc: Roland McGrath <roland at hack dot frob dot com>, KOSAKI Motohiro<kosaki dot motohiro at gmail dot com>, "Carlos O'Donell" <carlos at systemhalted dot org>, Rich Felker <dalias at aerifal dot cx>
- Date: Mon, 24 Sep 2012 17:37:52 +0530
- Subject: Ping[2]: [PATCH v2] Allow shrinking of arena heaps using mmap basedon overcommit settings when available
- References: <20120720223800.GB26330@sunsite.ms.mff.cuni.cz><CAHGf_=qCMy6K1MD4miN65GkMSumYTtH23xoFrfmCuh=WjybAVA@mail.gmail.com><20120730230006.355f9b67@spoyarek><5016D012.5000101@gmail.com><20120730191758.GX544@brightrain.aerifal.cx><CAHGf_=rRm4B4YCZKgos5hWN_QTYV76fAxcegO7D3x=4_A88Rvw@mail.gmail.com><20120731132705.GZ544@brightrain.aerifal.cx><CAHGf_=pN3KJGL_V1tQ2+o0=-RY4q2du7PJDnak9y7xyzYiH1tQ@mail.gmail.com><20120810235226.408e3cec@spoyarek><CADZpyiz05WnMqrREEtSs+oW_0Ld6hnfxbmFMk_hKYL-P_gFTag@mail.gmail.com><20120811205228.42ab905f@spoyarek><CADZpyizkMLBGK13-h-YH_CpVgbcx3n7gbxYAwxzsdbiEJOMNjg@mail.gmail.com><50289F84.9060205@gmail.com><20120822000610.6110da3f@spoyarek><20120822141946.7702d182@spoyarek><20120823205321.A03E02C0FB@topped-with-meat.com><20120824205628.552958b6@spoyarek><20120907165911.6A8232C0D0@topped-with-meat.com><20120911154036.0a958e01@spoyarek><20120917111655.1cc3af25@spoyarek>
ping!
regards,
Siddhesh
On Mon, 17 Sep 2012 11:16:55 +0530, Siddhesh wrote:
> 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.
>