This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: malloc using mprotect
On Fri, Aug 10, 2001 at 12:38:33PM +0200, Wolfram Gloger wrote:
> top_pad is actually set to 0 by default. Maybe we should set it to
> 32k, 64k or something like that?
Probably.
> > mprotect does not do any segment merging in 2.4, so each single page
> > consumes one vma.
>
> Ahem.. oh my god! Let me make sure I understand this:
>
> - mmap(...128k..) still takes one VMA, not 32.
>
> however
>
> - calling mmap(..4k..) successively _even at consecutive addresses_
> now always takes 32 VMAs
No, that will actually take one VMA too, provided it is anonymous private
mapping. mmap does some minimal merging
/* Can we just expand an old anonymous mapping? */
if (addr && !file && !(vm_flags & VM_SHARED)) {
struct vm_area_struct * vma = find_vma(mm, addr-1);
if (vma && vma->vm_end == addr && !vma->vm_file &&
vma->vm_flags == vm_flags) {
vma->vm_end = addr + len;
goto out;
}
}
while mprotect does not do any.
> When exactly was this introduced and why?
AFAIK there were some locking issues and stuff like that why merge_segments
was removed.
Jakub