Bug 2236255

Summary: posix_memalign performance regression in glibc 2.38
Product: [Fedora] Fedora Reporter: Fabio Valentini <decathorpe>
Component: glibcAssignee: Carlos O'Donell <codonell>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 39CC: arjun.is, codonell, dj, fberat, fweimer, jlaw, mcermak, mcoufal, mfabian, pfrankli, sipoyare, skolosov
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: glibc-2.38-3.fc39 glibc-2.38.9000-5.fc40 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-09-26 13:29:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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.