[PATCH] Cleanup code duplication in malloc on fallback to use another arena
Siddhesh Poyarekar
siddhesh@redhat.com
Wed Sep 5 11:00:00 GMT 2012
On Tue, 04 Sep 2012 18:44:53 -0300, Alexandre wrote:
> I'd have preferred to place this in arena.c instead, where other arena
> selection code is. Would you consider doing that along with the
> following fix?
OK, I guess arena.c is the more suitable place for this function.
> Of these 3 functions, that impose additional alignment requirements,
> only the last one is passing to get_another_arena the same size passed
> to arena_get. I think this is a mistake (cut&pasto?)
That's an interesting observation. It may not make a difference when a
thread is already associated with an arena, but when a new arena is
created, this may result in two mprotect calls on the arena, once for
'bytes' and the second time for the aligned size. I'll verify this. If
it needs a change, then I think we could do it as a separate fix, since
this patch is just intended to be a cleanup.
> Now, how about renaming get_another_arena to say arena_get_retry, or
> arena_get3 ;-) for greater similarity with the other functions that
> choose an arena?
I don't like arena_get2 as a function name, so I'll hate arena_get3
even more. arena_get_retry is good though :)
I've attached the updated patch.
Regards,
Siddhesh
ChangeLog:
* malloc/arena.c (arena_get_retry): New function that gets
another arena for the caller to try its request on.
* malloc/malloc.c (__libc_malloc): Use get_another_arena if the
current arena cannot fulfil the request.
(__libc_memalign): Likewise.
(__libc_memalign): Likewise.
(__libc_pvalloc): Likewise.
(__libc_calloc): Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: glibc-other-arena.patch
Type: text/x-patch
Size: 6071 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20120905/dc086a5a/attachment.bin>
More information about the Libc-alpha
mailing list