Subject: Re: Performance Problem: malloc() is calling madvise()
To: Simon Burge <simonb@netbsd.org>
From: Jason R Thorpe <thorpej@zembu.com>
List: current-users
Date: 05/19/2000 07:44:51
On Fri, May 19, 2000 at 09:38:46PM +1000, Simon Burge wrote:

 > The man page for malloc() talks more about this.  Hmm, it also says the
 > calls to madvise() are off by default!  FreeBSD changed the default
 > from on to off at some stage - we grabbed their code before the change
 > and their manpage after it.  They changed it because "Recent VM system
 > changes have made this too expensive." - our madvise() manpage says that
 > until NetBSD 1.5 (ie in -current between 1.4 and 1.5), madvise() did
 > nothing.  Anyone object to me changing the default to match the manpage
 > and what FreeBSD currently does?

Yes, we should probably change malloc(3) to default to "no MADV_FREE by
default", although it would be nice if malloc() were a little smarter
about it and gave the advice when there was some threshold of pages free.

Looks like what it does it just always give the advice every time a
page is put on the free list.  That's sort of silly in e.g. the C++
case, as you're going to get a big ping-pong effect.

-- 
        -- Jason R. Thorpe <thorpej@zembu.com>