Re: missing madvise functionality
From: Arnd Bergmann
Date: Tue Apr 03 2007 - 18:07:51 EST
On Tuesday 03 April 2007, Ulrich Drepper wrote:
> The problem is glibc has to work around kernel limitations. If the
> malloc implementation detects that a large chunk of previously allocated
> memory is now free and unused it wants to return the memory to the
> system. What we currently have to do is this:
>
> to free: mmap(PROT_NONE) over the area
> to reuse: mprotect(PROT_READ|PROT_WRITE)
>
> Yep, that's expensive, both operations need to get locks preventing
> other threads from doing the same.
I thought this is what the read_zero_pagealigned hack [1] was used
for (read from /dev/zero replaces target pages with empty_zero_page).
Now if read_zero_pagealigned does not solve _this_ scenario, is it
good for anything else then?
Can we simply kill that function as a misfeature and avoid future
pain arising from it?
Arnd <><
[1] http://lkml.org/lkml/1997/1/16/49
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/