Question about madvise(DONTNEED) in glibc malloc
Rich Felker
dalias@aerifal.cx
Mon Apr 15 02:51:00 GMT 2013
On Sun, Apr 14, 2013 at 11:12:22PM +0530, Siddhesh Poyarekar wrote:
> > Performance counter stats for './ebizzy -S 3':
> >
> > 23919.162533 task-clock # 7.945 CPUs utilized
> > 2,533 context-switches # 0.106 K/sec
> > 77 CPU-migrations # 0.003 K/sec
> > 4,256 page-faults # 0.178 K/sec
>
> This doesn't prove that glibc use of MADV_DONTNEED is wrong. What
> this proves is that never giving memory back to the system results in
> crazy fast performance since we reduce syscall overhead. It doesn't
> justify never returning memory back to the system though.
This is exactly what I was about to say. If you want the highest
performance malloc, you implement malloc as sbrk (plus storing the
size because realloc needs it) and free as nop. It's not impressive
for an allocator to perform better than glibc (but still much worse
than the fastest-possible one I just described) if it avoids returning
unused memory to the system....
Rich
More information about the Libc-alpha
mailing list