Subject: Re: PROPOSAL: removal of brk()/sbrk().
To: None <tech-kern@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 02/28/2002 15:17:47
> I don't actually see why there is a gain from using mmap() directly
> for malloc()?
Well, there isn't any, per se. The gain actually comes from
eliminating sbrk (and brk) entirely; making malloc use mmap is related
only because that's the only place anyone has come up with for malloc
to get new memory if sbrk vanishes.
The gain I refer to is mostly that there is no need to maintain a
max-data-segment-size VM hole between the current break and the lowest
place the system may put an mmapped segment. (Okay, the hole size is
actually max data segment size minus current data segment size.) On
machines with single-level page tables (like the VAX), maintaining that
hole is a pain.
By moving things around in VM, it's possible to shrink the hole to the
maximum stack size, which is usually less than the maximum data size.
But by removing sbrk/brk entirely, it's possible to eliminate it
altogether.
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML mouse@rodents.montreal.qc.ca
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B