On 04/10/2010 11:47 PM, Andrea Arcangeli wrote:
On Sat, Apr 10, 2010 at 11:42:44PM +0300, Avi Kivity wrote:
3-5% improvement. I had to tune khugepaged to scan more aggressively
since the run is so short. The working set is only ~100MB here though.
We need to either solve it with a kernel workaround or have an
environment var for glibc to do the right thing...
IMO, both. The kernel should align vmas on 2MB boundaries (good for
small pages as well). glibc should use 2MB increments. Even on <2MB
sized vmas, the kernel should reserve the large page frame for a while
in the hope that the application will use it in a short while.
The best I got so far with gcc is with, about half goes in hugepages
with this but it's not enough as likely lib invoked mallocs goes into
heap and extended 1M at time.
There are also guard pages around stacks IIRC, we could make them 2MB on
x86-64.
export MALLOC_MMAP_THRESHOLD_=$[1024*1024*1024]
export MALLOC_TOP_PAD_=$[1024*1024*1024]
Whatever we do, it has to be possible to disable it of course with
malloc debug options, or with electric fence of course, but it's not
like the default 1M provides any benefit compared to growing it 2M
aligned ;) so it's quite an obvious thing to address in glibc in my
view.
Well, but mapping a 2MB vma with a large page could be a considerable
waste if the application doesn't eventually use it. I'd like to map the
pages with small pages (belonging to a large frame) and if the
application actually uses the pages, switch to a large pte.
Something that can also improve small pages is to prefault the vma with
small pages, but with the accessed and dirty bit cleared. Later, we
check those bits and reclaim the pages if they're unused, or coalesce
them if they were used. The nice thing is that we save tons of page
faults in the common case where the pages are used.
--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>