public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "fweimer at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug malloc/30723] Repeated posix_memalign calls produce long free lists, high fragmentation
Date: Fri, 11 Aug 2023 09:24:13 +0000	[thread overview]
Message-ID: <bug-30723-131-xHE7eGuUNQ@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-30723-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=30723

--- Comment #4 from Florian Weimer <fweimer at redhat dot com> ---
First part committed:

commit 542b1105852568c3ebc712225ae78b8c8ba31a78
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Aug 11 11:18:17 2023 +0200

    malloc: Enable merging of remainders in memalign (bug 30723)

    Previously, calling _int_free from _int_memalign could put remainders
    into the tcache or into fastbins, where they are invisible to the
    low-level allocator.  This results in missed merge opportunities
    because once these freed chunks become available to the low-level
    allocator, further memalign allocations (even of the same size are)
    likely obstructing merges.

    Furthermore, during forwards merging in _int_memalign, do not
    completely give up when the remainder is too small to serve as a
    chunk on its own.  We can still give it back if it can be merged
    with the following unused chunk.  This makes it more likely that
    memalign calls in a loop achieve a compact memory layout,
    independently of initial heap layout.

    Drop some useless (unsigned long) casts along the way, and tweak
    the style to more closely match GNU on changed lines.

    Reviewed-by: DJ Delorie <dj@redhat.com>

Second part is still under review, I need to send a v2.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2023-08-11  9:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-05  2:37 [Bug malloc/30723] New: posix_memalign performance regression toolybird at tuta dot io
2023-08-05  3:02 ` [Bug malloc/30723] posix_memalign performance regression in glibc-2.38 (since 24cdd6c71debfd10a9f7cb217fe2a2c4c486ed6f?) sam at gentoo dot org
2023-08-05  3:04 ` sam at gentoo dot org
2023-08-05 13:13 ` freswa at archlinux dot org
2023-08-05 21:54 ` dilfridge at gentoo dot org
2023-08-06 18:23 ` kocelfc at tutanota dot com
2023-08-09 18:54 ` [Bug malloc/30723] Repeated calls posix_memalign calls produce long free lists, high fragmentation fweimer at redhat dot com
2023-08-09 19:37 ` [Bug malloc/30723] Repeated " fweimer at redhat dot com
2023-08-10  5:45 ` toolybird at tuta dot io
2023-08-11  6:11 ` toolybird at tuta dot io
2023-08-11  9:24 ` fweimer at redhat dot com [this message]
2023-08-15  6:25 ` fweimer at redhat dot com
2023-09-11  8:02 ` [Bug malloc/30723] Poor posix_memalign performance with long free lists fweimer at redhat dot com
2023-09-11  8:03 ` fweimer at redhat dot com

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=bug-30723-131-xHE7eGuUNQ@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@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).