general question about lazy loading of shared libraries

Arjan van de Ven arjanv at redhat.com
Fri Nov 19 12:16:34 UTC 2004


On Fri, Nov 19, 2004 at 07:07:12AM -0500, John Ellson wrote:
> >but you can tell which pages are in memory at least. If people want I
> >can code a small app for this
> > 
> >
> Don't go out of your way, but if you have some snippets of code I can 
> look at it would be appreciated.

basically you want to use the mincore() syscall; it will tell you which
parts of the file are in memory (you need to mmap it first).

Note that this gives the status of the kernel page cache; so if you want a
honest measurement you need to somehow clear that cache first (for example
by unmounting + remounting the fs the library is on)

> >no that happens always (even with the main binary btw); the difference
> >prelink makes is that without prelink you need to touch (and thus load)
> >more pages even if you don't use the library, for relocations.
> > 
> >
> So if I understand, deferred paging doesn't depend on prelinking, but if 
> I am going to try to measure
> avoided-page-loads then I should make sure that prelinking has been done?

I'd recommend that yes; you get a more "honest" answer since prelink is on
by default in basically all modern distributions




More information about the devel mailing list