http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50636
--- Comment #5 from Andi Kleen <andi-gcc at firstfloor dot org> 2011-10-06 21:46:32 UTC --- If it's a 2MB page then madvise MADV_DONTNEED will split it if it's not 2MB aligned. It would be good to optimize the freeing pattern so that this happens rarely. I will try to do some numbers how much 2MB pages improves performance. If yes we could also do a MADV_HUGEPAGE by default. But short term fix would be simply to have a threshold for freepages before freeing?