public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Xi Ruoyao <xry111@xry111.site>
To: DJ Delorie <dj@redhat.com>, Sam James <sam@gentoo.org>
Cc: adhemerval.zanella@linaro.org, libc-alpha@sourceware.org,
	 dilfridge@gentoo.org, timo@rothenpieler.org
Subject: Re: posix_memalign performance regression in 2.38?
Date: Tue, 08 Aug 2023 16:08:32 +0800	[thread overview]
Message-ID: <e6e8c4f3f0abee73966021f6f207eedd51b77049.camel@xry111.site> (raw)
In-Reply-To: <xno7jip5jg.fsf@greed.delorie.com>

On Mon, 2023-08-07 at 23:38 -0400, DJ Delorie wrote:
> 
> Reproduced.
> 
> In the case where I reproduced it, the most common problematic case was
> an allocation of 64-byte aligned chunks of 472 bytes, where 30 smallbin
> chunks were tested without finding a match.
> 
> The most common non-problematic case was a 64-byte-aligned request for
> 24 bytes.
> 
> There were a LOT of other size requests.  The smallest I saw was TWO
> bytes.  WHY?  I'm tempted to not fix this, to teach developers to not
> use posix_memalign() unless they REALLY need it ;-)


Have you tested this?

$ cat t.c
#include <stdlib.h>
int main()
{
	void *buf;
	for (int i = 0; i < (1 << 16); i++)
		posix_memalign(&buf, 64, 64);
}

To me this is quite reasonable (if we just want many blocks each can fit
into a cache line), but this costs 17.7 seconds on my system.  Do you
think people just should avoid this?  If so we at least need to document
the issue in the manual.

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

  reply	other threads:[~2023-08-08  8:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-04  2:52 Xi Ruoyao
2023-08-04 14:12 ` Adhemerval Zanella Netto
2023-08-07 19:49   ` DJ Delorie
2023-08-07 19:57     ` Sam James
2023-08-07 20:15       ` DJ Delorie
2023-08-08  3:38       ` DJ Delorie
2023-08-08  8:08         ` Xi Ruoyao [this message]
2023-08-08 15:08           ` DJ Delorie
2023-08-09 10:47           ` Florian Weimer
2023-08-09 16:59             ` Florian Weimer
2023-08-07 19:58     ` Noah Goldstein
2023-08-07 20:07       ` DJ Delorie

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=e6e8c4f3f0abee73966021f6f207eedd51b77049.camel@xry111.site \
    --to=xry111@xry111.site \
    --cc=adhemerval.zanella@linaro.org \
    --cc=dilfridge@gentoo.org \
    --cc=dj@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=sam@gentoo.org \
    --cc=timo@rothenpieler.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).