This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH][RFC] Allow explicit shrinking of arena heaps using anenvironment variable
- From: Rich Felker <dalias at aerifal dot cx>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 1 Aug 2012 00:13:04 -0400
- Subject: Re: [PATCH][RFC] Allow explicit shrinking of arena heaps using anenvironment variable
- References: <20120721061814.GC26330@sunsite.ms.mff.cuni.cz><20120721133217.GY544@brightrain.aerifal.cx><20120725183634.E0C5F2C0B1@topped-with-meat.com><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><5017DECB.9030405@redhat.com>
On Tue, Jul 31, 2012 at 03:34:03PM +0200, Florian Weimer wrote:
> On 07/31/2012 03:27 PM, Rich Felker wrote:
>
> >I think this is about the third or forth time I've explained it now.
> >PROT_NONE is needed to actually free the memory for other processes to
> >use. MADV_DONTNEED frees the physical memory (eliminates dirty pages
> >and thus prevents costly swapping of worthless data), but it does not
> >free the commit charge because the pages are still potentially
> >writable and thus not permanently backed by the zero page even though
> >they initially just reference it.
>
> Good catch. Do you know if this is part of the kernel ABI these
> days? Last time I checked, it was not documented behavior, so I
> feared that it was an accident of implementation.
Which part are you talking about? The subtracting from commit charge?
Assuming your definition of commit charge for a process is the minimum
amount of memory that must be reserved for it to make overcommit
impossible (with no further assumptions on the process's behavior),
omitting non-writable cleanly-backed mappings from the commit charge
accounting is just part of the definition of commit charge. If Linux
(or any kernel) failed to do so, it would be a major bug in commit
accounting that would lead to major spurious allocation failures and
inefficient use of memory.
Rich