Bug 2236255 - posix_memalign performance regression in glibc 2.38
Summary: posix_memalign performance regression in glibc 2.38
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: 39
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Carlos O'Donell
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-08-30 19:50 UTC by Fabio Valentini
Modified: 2023-09-26 13:29 UTC (History)
12 users (show)

Fixed In Version: glibc-2.38-3.fc39 glibc-2.38.9000-5.fc40
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-09-26 13:29:36 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Sourceware 30723 0 P2 ASSIGNED Repeated posix_memalign calls produce long free lists, high fragmentation 2023-08-30 20:37:22 UTC

Description Fabio Valentini 2023-08-30 19:50:59 UTC
I recently noticed a pretty bad regression in performance in tokio (the most popular async runtime for Rust), and reported it with tokio:

https://github.com/tokio-rs/tokio/issues/5955

The profiling results / flamegraphs I posted on the issue show a pretty bleak picture. Doing some digging with help from tokio developers, it appears that the standard mechanism by which Rust code can request memory alignment (annotating structs with "#[repr(align(N))]" where N is a power of 2) relies on posix_memalign, which started being *much much slower* with glibc 2.38:

https://doc.rust-lang.org/reference/type-layout.html#the-alignment-modifiers
https://sourceware.org/pipermail/libc-alpha/2023-August/150653.html

This is pretty bad for a performance sensitive component like an async runtime.

Reproducible: Always

Comment 1 Fedora Update System 2023-08-30 20:15:34 UTC
FEDORA-2023-a650119fa5 has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-a650119fa5

Comment 2 Florian Weimer 2023-08-30 20:18:44 UTC
This was already fixed in dist-git, but we forgot to submit the Bodhi update.

Comment 3 Fabio Valentini 2023-08-30 20:33:31 UTC
Looks like I ran my tests only a few hours before rawhide got glibc-2.38.9000-5.fc40, which also has these changes ... I'll re-run the tests with the new versions, thanks!

Comment 4 Fedora Update System 2023-08-31 01:48:54 UTC
FEDORA-2023-a650119fa5 has been pushed to the Fedora 39 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-a650119fa5`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-a650119fa5

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 5 Fedora Update System 2023-09-12 01:23:15 UTC
FEDORA-2023-24a71a63ed has been pushed to the Fedora 39 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-24a71a63ed`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-24a71a63ed

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 6 Fedora Update System 2023-09-26 00:17:13 UTC
FEDORA-2023-24a71a63ed has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.