http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50636

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-10-07 
10:01:32 UTC ---
(In reply to comment #2)
> Perhaps on Linux, at least with recentish kernel, we could change 
> release_pages
> into keeping the pages in the G.free_pages chain, but call madvise
> MADV_DONTNEED on the pages (and remember that we've done that so next
> release_pages won't do it again unless we have since then alloc_page'd it).  
> At
> least on 64-bit hosts where there is plenty of address space.  MADV_DONTNEED
> will keep it around unless the kernel needs it for something else (something
> e.g. glibc malloc uses too).

Seems I misremembered what MADV_DONTNEED it, what I described was the proposed
and unfortunately shot down MADV_FREE.  MADV_DONTNEED zaps the pages
immediately, so you get new zeroed pages even if it is touched immediately
after the madvise call.  Still, even MADV_DONTNEED is useful, it will prevent
the excessive fragmentation.

Reply via email to