[all-commits] [llvm/llvm-project] 2d1bc4: [libc++] Fix usage of constructive interference wh...

Louis Dionne via All-commits all-commits at lists.llvm.org
Tue Jul 14 04:51:28 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2d1bc4fc5d00d6c96307d5375d7259011509faf3
      https://github.com/llvm/llvm-project/commit/2d1bc4fc5d00d6c96307d5375d7259011509faf3
  Author: Louis Dionne <ldionne.2 at gmail.com>
  Date:   2026-07-14 (Tue, 14 Jul 2026)

  Changed paths:
    M libcxx/src/atomic.cpp

  Log Message:
  -----------
  [libc++] Fix usage of constructive interference when we meant destructive (#208804)

We maintain a contention table to implement atomic wait/notify inside
atomic.cpp. Entries in that table are padded to avoid false sharing,
since they are expected to be accessed from multiple threads
concurrently.

However, we used std::hardware_constructive_interference_size for that,
when in reality std::hardware_destructive_interference_size is the one
we need. The semantics of constructive interference are to promote true
sharing for data that should stay colocated, while destructive
interference is to prevent false sharing.

Note that on platforms such as macOS arm64, destructive interference
size is larger than constructive interference size, which means that
this patch may regress the size of the dylib on some platforms. However,
that is required for performance purposes.

Fixes #208305



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list