public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Zack Weinberg <zack@owlfolio.org>
To: DJ Delorie <dj@redhat.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH] malloc: Use correct C11 atomics for fastbin
Date: Sun, 11 Dec 2022 22:35:25 -0500	[thread overview]
Message-ID: <ypiktu21thtu.fsf@owlfolio.org> (raw)
In-Reply-To: <xnfsds5wty.fsf@greed.delorie.com> (DJ Delorie's message of "Tue, 06 Dec 2022 11:19:21 -0500")

DJ Delorie <dj@redhat.com> writes:

> Zack Weinberg via Libc-alpha <libc-alpha@sourceware.org> writes:
>> Every time we start talking about fastbins vs tcache again I start 
>> wondering, again, what's stopping us from replacing the entire malloc 
>> implementation with jemalloc,
>
> There's a couple of things, but they're technical details, not political
> ones:
>
> * There's a copy of a "mini-malloc" in the dynamic loader that needs to
>   be somewhat compatible with the full copy in libc.so so that data
>   allocated in the loader can be used later.

Hmm.  Why does the dynamic loader need to be able to allocate memory at
all, and how does it manage to play nice with LD_PRELOADed malloc
replacements if it does this?

> * The current malloc knows a lot about glibc internals like pthreads and
>   fork, so as to manage those boundaries properly (thread start/stop,
>   etc).

Similarly I am wondering how _this_ manages to work with LD_PRELOADed
malloc replacements.  (I confess I haven’t ever dug into this part of
glibc much at all.)

> * Benchmarks have shown that the various mallocs each have their strong
>   points and weak points, so expect some complaints about performance
>   loss when switching mallocs.  Your favorite allocator may perform
>   poorly in someone else's favorite application.
> * Testing, testing, testing.  Libc's malloc is used in all Linux distros
>   *and* Hurd, which means it's known to work with tens if not hundreds of
>   thousands of programs.  To propose a new system-wide allocator, you
>   need to replicate this level of effective testing.

It seems to me that this sets the bar for _any_ major change to glibc
malloc so high that it won’t ever happen, and given that every benchmark
_I’ve_ been pointed at shows glibc malloc coming in somewhere between
“mediocre” and “dead last”, that’s a shame.

zw

  reply	other threads:[~2022-12-12  3:37 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-21 16:09 Wilco Dijkstra
2022-11-21 16:18 ` Florian Weimer
2022-11-21 16:55   ` Wilco Dijkstra
2022-11-21 16:56     ` Wilco Dijkstra
2022-11-21 17:00     ` Florian Weimer
2022-12-02  5:11 ` DJ Delorie
2022-12-02  6:36   ` Florian Weimer
2022-12-02 10:56     ` Wilco Dijkstra
2022-12-02 11:24       ` Florian Weimer
2022-12-02 12:02         ` Wilco Dijkstra
2022-12-02 18:55           ` DJ Delorie
2022-12-05 18:39             ` Zack Weinberg
2022-12-06 16:19               ` DJ Delorie
2022-12-12  3:35                 ` Zack Weinberg [this message]
2022-12-12 11:57                   ` Florian Weimer
2022-12-12 11:56                 ` Florian Weimer
2022-12-06 13:29             ` Wilco Dijkstra
2022-12-06 13:37               ` Adhemerval Zanella Netto
2022-12-06 14:31                 ` Zack Weinberg
2022-12-06 16:23               ` DJ Delorie
2022-12-15 15:43                 ` Wilco Dijkstra
2022-12-02 18:55     ` DJ Delorie
2022-12-06 15:04 Wilco Dijkstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ypiktu21thtu.fsf@owlfolio.org \
    --to=zack@owlfolio.org \
    --cc=dj@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).