From: Aurelien Jarno <aurelien@aurel32.net>
To: Siddhesh Poyarekar <siddhesh@sourceware.org>
Cc: libc-alpha@sourceware.org, Nicolas Dusart <nicolas@freedelity.be>
Subject: Re: [PATCH] realloc: Limit chunk reuse to only growing requests [BZ #30579]
Date: Wed, 5 Jul 2023 20:30:15 +0200 [thread overview]
Message-ID: <ZKW2t3uZWhSsbUc+@aurel32.net> (raw)
In-Reply-To: <ba27e356-f944-1dd5-c2ab-45d9458737ec@sourceware.org>
On 2023-07-05 10:37, Siddhesh Poyarekar via Libc-alpha wrote:
> On 2023-07-05 07:55, Aurelien Jarno wrote:
> > Hi,
> >
> > On 2023-07-04 14:24, Siddhesh Poyarekar via Libc-alpha wrote:
> > > The trim_threshold is too aggressive a heuristic to decide if chunk
> > > reuse is OK for reallocated memory; for repeated small, shrinking
> > > allocations it leads to internal fragmentation and for repeated larger
> > > allocations that fragmentation may blow up even worse due to the dynamic
> > > nature of the threshold.
> > >
> > > Limit reuse only when it is within the alignment padding, which is 2 *
> > > size_t for heap allocations and a page size for mmapped allocations.
> > > There's the added wrinkle of THP, but this fix ignores it for now,
> > > pessimizing that case in favor of keeping fragmentation low.
> > >
> > > This resolves BZ #30579.
> > >
> > > Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
> > > Reported-by: Nicolas Dusart <nicolas@freedelity.be>
> > > Reported-by: Aurelien Jarno <aurelien@aurel32.net>
> > > ---
> > >
> > > The test case in the bz seems fixed with this, bringing VSZ and RSS back
> > > to ~40M from ~1G. Aurelien, can you please test with plasma desktop?
> > Thanks for the quick fix. I confirm that this patch fixes the issue with
> > plasma desktop.
>
> Thanks, if you think the fix is OK, can you please give a Reviewed-by? I
> will then backport this to the 2.37 branch as well.
Yep, of course.
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Tested-by: Aurelien Jarno <aurelien@aurel32.net>
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien@aurel32.net http://aurel32.net
prev parent reply other threads:[~2023-07-06 10:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-04 18:24 Siddhesh Poyarekar
2023-07-05 7:08 ` Nicolas Dusart
2023-07-05 10:46 ` Siddhesh Poyarekar
2023-07-05 11:55 ` Aurelien Jarno
2023-07-05 14:37 ` Siddhesh Poyarekar
2023-07-05 18:30 ` Aurelien Jarno [this message]
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=ZKW2t3uZWhSsbUc+@aurel32.net \
--to=aurelien@aurel32.net \
--cc=libc-alpha@sourceware.org \
--cc=nicolas@freedelity.be \
--cc=siddhesh@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).