This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Question about madvise(DONTNEED) in glibc malloc
- From: KOSAKI Motohiro <kosaki dot motohiro at gmail dot com>
- To: Siddhesh Poyarekar <siddhesh dot poyarekar at gmail dot com>
- Cc: KOSAKI Motohiro <kosaki dot motohiro at gmail dot com>, libc-alpha <libc-alpha at sourceware dot org>
- Date: Sun, 14 Apr 2013 22:11:50 -0700
- Subject: Re: Question about madvise(DONTNEED) in glibc malloc
- References: <516ADB3C dot 9040805 at gmail dot com> <CAAHN_R23vHH4B_=GUHFXAfcRL5gFrOp6dyBLcskCQNG5VswxAA at mail dot gmail dot com>
(4/14/13 9:12 PM), Siddhesh Poyarekar wrote:
> On 14 April 2013 22:07, KOSAKI Motohiro <kosaki.motohiro@gmail.com> wrote:
>> Now, we linux MM folks discuss are discussing about new memory discarding feature.
>> (https://lkml.org/lkml/2013/3/12/105). The motivation is similar wtih MADV_FREE,
>> but more efficient. (http://lwn.net/Articles/230799)
>
> I just went through this and it looks interesting as a replacement for
> MADV_DONTNEED in malloc. Please let us know what becomes of this so
> that we could explore the possibility of using it in malloc.
Firstly, this api is still under discusstion and any feedback has a chance to change
api design.
The idea is simple. vrange(VOLATILE) just mark the argument pages is discardable. but
doesn't discard. No page table walk, No TLB shootdown, No anything more.
Touching the VOLATILed range, makes SIGBUG. you need to call vrange(NOVOLATILE) because
you begin to use again.
When kernel meet memory starvation, kerenl may discared VOLATILed pages instead of swap
out. Of cource, jsut dropping is much faster than disk write. More importantly, as far as
system has enough memory, this heaviy weight pte nuke never run.
Please feel free to ask everything. We add more document to the man page or change the design.