This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2] Add malloc micro benchmark
- From: Carlos O'Donell <carlos at redhat dot com>
- To: Florian Weimer <fweimer at redhat dot com>, Ondřej Bílka <neleai at seznam dot cz>
- Cc: Joseph Myers <joseph at codesourcery dot com>, Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>, "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>, nd <nd at arm dot com>
- Date: Wed, 28 Feb 2018 08:16:13 -0800
- Subject: Re: [PATCH v2] Add malloc micro benchmark
- Authentication-results: sourceware.org; auth=none
- References: <DB6PR0801MB205334E9F59632F30A17202683390@DB6PR0801MB2053.eurprd08.prod.outlook.com> <bcc3af78-c1ac-2d24-6a6a-c14d6ca7dc96@redhat.com> <DB6PR0801MB20538A414F1659748E703918833C0@DB6PR0801MB2053.eurprd08.prod.outlook.com> <6ad98d83-d49b-25a3-ef01-e93e18f4740b@redhat.com> <DB6PR0801MB2053641333453CE91496266E83190@DB6PR0801MB2053.eurprd08.prod.outlook.com> <96b76d58-d2f0-2176-51e5-f6338ed079e1@redhat.com> <alpine.DEB.2.20.1801051621180.14880@digraph.polyomino.org.uk> <a55c0575-f89d-0a05-7269-e38653b2b16e@redhat.com> <165192eb-d815-867f-e1ba-0f9972eb19cd@redhat.com> <20180228141126.GA13073@domone> <808ed1e2-5945-0712-87a5-a0408de55fb0@redhat.com>
On 02/28/2018 06:16 AM, Florian Weimer wrote:
> On 02/28/2018 03:11 PM, Ondřej Bílka wrote:
>> Thats rather ineffective, it is easier to start fresh than try to
>> maintain rather obsolete allocator. Most of other are faster and
>> more space effective because of their layout.
>
> That's not quite true. Despite its limitations, glibc malloc still
> compares remarkably well to other allocators. Of course, there are
> workloads where it loses big, but those exist for other allocators,
> too. People simple don't write blog posts comparing *alloc with
> glibc malloc if glibc malloc provides comparable or better
> performance because it's quite boring.
>
> I think a heap-style allocator which does not segregate allocations
> of different sizes still has its place, and why not provide one in
> glibc?
I agree.
I think an incremental improvement would be to start with some further
code cleanups, all with the goal of simplifying the allocator maintenance.
Getting rid of unsorted bins would be interesting. One of the problems I
see is that without changes in our data structures and algorithms it is hard
for a heap-style allocator to keep a bound on the total amount of heap consumed.
One of the big requirements that I see coming down the pipe is to provide an
allocator that has bounded memory usage. To do that we'd have to track all of
the unsorted blocks, free blocks, consolidate more regularly, and free against
the heuristic which tells us how much memory to keep cached. If having got rid
of unsorted makes this easier, if having a balanced binary tree makes this
easier, then that's where we should be looking.
--
Cheers,
Carlos.