Skip to content

feat(allocator): enable jemalloc on aarch64-unknown-linux-gnu - #4613

Open
ergdevops wants to merge 1 commit into
linkerd:mainfrom
ergdevops:jemalloc-aarch64
Open

ergdevops wants to merge 1 commit into
linkerd:mainfrom
ergdevops:jemalloc-aarch64

Conversation

@ergdevops

Copy link
Copy Markdown

jemalloc is currently compiled in as the global allocator only for x86_64-unknown-linux-gnu. On arm64 the proxy silently falls back to glibc malloc, which sizes its per-CPU arena budget from the host core count rather than the cgroup limit and in practice does not return freed memory to the OS. Proxy RSS on arm64 therefore ratchets up with peak load and stays there until the pod restarts, and any MALLOC_CONF tuning users apply is a silent no-op.

Measured on an arm64 cluster with ~300 pooled HTTP/2 connections per pod: closing all connections released no RSS at all with glibc, and 211MB -> ~20MB (-91%) with jemalloc, same proxy version and traffic.

The x86_64-only gate dates to #1321, which restricted it to the only platform the then-current jemallocator readme listed as fully tested. tikv-jemallocator 0.6 supports aarch64-unknown-linux-gnu, so widen the gate to cover it. Cargo.lock is unchanged.

@ergdevops
ergdevops requested a review from a team as a code owner August 24, 2026 17:21
jemalloc is currently compiled in as the global allocator only for
x86_64-unknown-linux-gnu. On arm64 the proxy silently falls back to
glibc malloc, which sizes its per-CPU arena budget from the host core
count rather than the cgroup limit and in practice does not return
freed memory to the OS. Proxy RSS on arm64 therefore ratchets up to
peak load and stays there until the pod restarts.

Measured against the release/v2.311.0 tag (shipped with edge-25.8.1),
patched as in this commit and built natively on arm64, on a Graviton
cluster with ~300 pooled HTTP/2 connections per pod: closing all
connections released no RSS at all with glibc, and 211MB -> ~20MB
(-91%) with jemalloc. Same proxy version, cluster and traffic in both
arms; the allocator was the only variable. This was on jemalloc's
stock settings -- tikv-jemalloc-sys builds with
--with-jemalloc-prefix=_rjem_, so the allocator reads
_RJEM_MALLOC_CONF and ignores unprefixed MALLOC_CONF.

The x86_64-only gate dates to linkerd#1321, which restricted it to the only
platform the then-current jemallocator readme listed as fully tested.
tikv-jemallocator supports aarch64-unknown-linux-gnu, and deny.toml
already audits that target, so widen the gate to cover it.

Cargo.lock is unchanged. Verified on main for x86_64: builds, tests
pass, and the binary still links jemalloc as its active allocator.
An aarch64 cross-build in CI conditions is not verified here.

Signed-off-by: ergdevops <115262164+ergdevops@users.noreply.github.com>
@ergdevops

Copy link
Copy Markdown
Author

hi @cratelyn applogies for the tag but i see you are assigned this issue: linkerd/linkerd2#15613
will be happy to initiate discussion on this PR to help you with what ever details required.

@cratelyn

cratelyn commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

hi, @ergdevops. per linkerd/linkerd2#15624, i am no longer an active maintainer. i should be unassigned from that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants