This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/5] Add single-threaded path to malloc/realloc/calloc/memalloc


Wilco Dijkstra <Wilco.Dijkstra@arm.com> writes:
> This patch adds a single-threaded fast path to malloc, realloc, 
> calloc and memalloc.  When we're single-threaded, we can bypass
> arena_get (which always locks the arena it returns) and just use
> the main arena.  Also avoid retrying a different arena.

Does SINGLE_THREAD_P return true if a multi-threaded app joins all its
threads, so that there's only one thread remaining?  If so, there will
still be more arenas in play that might be usable, and the remaining
thread might be better served by whatever arena it had been using, due
to data locality on NUMA machines.

I also wonder if there's an upper limit to the main arena, where we'd
have to use other arenas to fully use available VM.

If either of these are issues, it might be better to conditionalize the
lock calls than to duplicate the code, so we keep the alt-arena code in
play.

(patch LGTM other than the above)

> +      assert (!victim || chunk_is_mmapped (mem2chunk (victim)) ||

Slight preference for "victim == NULL" here but I see it's consistent
with other checks elsewhere, so OK.  I'll worry about it later :-)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]