Skip to content

Unhardcode alignas cache line size#15213

Merged
xokdvium merged 2 commits intoNixOS:masterfrom
xokdvium:unhardcode-alignas-cache-line-size
Feb 12, 2026
Merged

Unhardcode alignas cache line size#15213
xokdvium merged 2 commits intoNixOS:masterfrom
xokdvium:unhardcode-alignas-cache-line-size

Conversation

@xokdvium
Copy link
Contributor

@xokdvium xokdvium commented Feb 12, 2026

Motivation

This expands to __GCC_DESTRUCTIVE_SIZE, which is also 64 (at least in the x86_64 stdenv).
Let the compiler decide what's the appropriate cache line size is. Also, on aarch64-darwin
the cache line size 128 bytes, so the previous fix didn't actually get rid of false sharing
reliably. Clang does this 1 2, so it overestimates the sizes somewhat, but that's still enough
for avoiding false sharing on darwin.

Context


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@xokdvium xokdvium requested a review from edolstra as a code owner February 12, 2026 18:10
@xokdvium xokdvium force-pushed the unhardcode-alignas-cache-line-size branch 2 times, most recently from 6aa2644 to 2dd1b92 Compare February 12, 2026 19:07
@Ericson2314 Ericson2314 added this pull request to the merge queue Feb 12, 2026
@xokdvium xokdvium removed this pull request from the merge queue due to a manual request Feb 12, 2026
…tive_interference_size

This expands to __GCC_DESTRUCTIVE_SIZE, which is also 64 (at least in the x86_64 stdenv).
Let the compiler decide what's the appropriate cache line size is. Also, on aarch64-darwin
the cache line size 128 bytes, so the previous fix didn't actually get rid of false sharing
reliably. Clang does this [1] [2], so it overestimates the sizes somewhat, but that's still enough
for avoiding false sharing on darwin.

[1]: https://github.com/llvm/llvm-project/blob/a289341dedf4d73955faefbb0b3c13881e13dd06/clang/lib/Frontend/InitPreprocessor.cpp#L1331-L1339
[2]: https://github.com/llvm/llvm-project/blob/6f51f8e0f93e6ff2baf0ed2f60021308920a557f/clang/lib/Basic/Targets/AArch64.h#L262-L264
@xokdvium xokdvium force-pushed the unhardcode-alignas-cache-line-size branch from 2dd1b92 to 7352205 Compare February 12, 2026 20:04
@xokdvium xokdvium enabled auto-merge February 12, 2026 20:05
@xokdvium xokdvium added this pull request to the merge queue Feb 12, 2026
Merged via the queue into NixOS:master with commit eae7e01 Feb 12, 2026
14 checks passed
@xokdvium xokdvium deleted the unhardcode-alignas-cache-line-size branch February 12, 2026 21:43
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