This is the mail archive of the
mailing list for the glibc project.
Re: Propose to Use madvise API on Runtime Loader
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: lin zuojian <manjian2006 at gmail dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Tue, 27 May 2014 21:26:10 +0200
- Subject: Re: Propose to Use madvise API on Runtime Loader
- Authentication-results: sourceware.org; auth=none
- References: <20140523012855 dot GC14217 at ubuntu>
On Fri, May 23, 2014 at 09:28:55AM +0800, lin zuojian wrote:
> I am trying to reduce the memory foot print of shared objects.After
> examine the layouts of many shared objects, I find out that the start
> part of a shared object will be seldom needed.
> So I add the following code to the runtime loader:
> madvice(si->base, si->rel + si->rel_count * 8, MADV_DONTNEED);
> And Find out the foot print drops proportionally dramatically.
> An very big shared object(libwebcore.so), drops from 7MB to 4MB.
> So I think it's a good idea to add this technique to the future
> madvice tell *nix system to let go the page table and the page in
> the specify range. But not the vma.
I would prefer these as part of daemon to decrease memory usage. It
could use rtld-audit la_objopen interface.
Then you could make it more general, it could learn which pages of
object are really used. It would have a learning stage where it
madvices a object and at end of program reads data from each page to
determine where are faults. Then on next loads of shared binary it could
drop pages that were not used in learning stage.