This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] malloc: Use current (C11-style) atomics for fastbin access
- From: Florian Weimer <fweimer at redhat dot com>
- To: DJ Delorie <dj at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Tue, 13 Nov 2018 10:34:44 +0100
- Subject: Re: [PATCH] malloc: Use current (C11-style) atomics for fastbin access
- References: <xnzhudrf61.fsf@greed.delorie.com>
* DJ Delorie:
> Florian Weimer <fweimer@redhat.com> writes:
>> * malloc/malloc.c (fastbin_push_entry): New function.
>> (fastbin_pop_entry): Likewise. Replaces REMOVE_FB.
>> (REMOVE_FB): Remove macro.
>> (_int_malloc): Use fastbin_pop_entry and reindent.
>> (_int_free): Use fastbin_push_entry.
>> (malloc_consolidate): Use atomic_exchange_acquire.
>
> All good with one minor nit...
>
>> + if (head == NULL)
>> + return NULL;
>> + else
>> + tail = head->fd;
>
> This "else" is superfluous. You can just have the tail = head->fd;
> statement after the "return NULL;". I think putting it in an "else"
> makes the (false) claim that it might have been executed otherwise.
Actually, it's not, due to the surrounding do-while. I'll remove the
else and add braces, though.
Thanks,
Florian