Re: malloc(3) (hopefully) set for 7.0

From: Poul-Henning Kamp <phk_at_phk.freebsd.dk>
Date: Thu, 29 Mar 2007 05:49:39 +0000
In message <460AE766.6050409_at_frebsd.org>, Jason Evans writes:

>However, there is a downside to 
>managing memory in chunks: unless we use madvise(2), every page of a 
>chunk that is touched remains physically backed until the entire chunk 
>can be unmapped.  Thus, even a single in-use page can cause retention of 
>up to 1MB of memory.  This is a bit of a catch-22, since madvise(2) is 
>too expensive to enable by default, but if we really need it, then we 
>really should be using it for all applications, since paging is a 
>system-wide issue.

The solution I have been advocating for years, is that the VM system
tell us a green/yellow/red status of memory availability, and send
a SIGVM to all processes when it gets worse.

malloc() could hook SIGVM and act intelligently based on it, and
really smart applications (a browser for instance) could hook SIGVM
and ditch the cache.

The actual flag color could be a free discovery, if we had a system-wide
mapped page in all processes.

That way, in all likelyhood, instead of starting to page out, the
processes would free enough "wasted" space, that we can avoid paging
out, at least for a fair bit longer.

Thanks for the good work on jemalloc :-)

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk_at_FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.
Received on Thu Mar 29 2007 - 03:49:43 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:07 UTC