[3.14] gh-144438: Fix false sharing between QSBR and tlbc_index (gh-144554) (#144923)

Align the QSBR thread state array to a 64-byte cache line boundary
and add padding at the end of _PyThreadStateImpl. Depending on heap
layout, the QSBR array could end up sharing a cache line with a
thread's tlbc_index, causing QSBR quiescent state updates to contend
with reads of tlbc_index in RESUME_CHECK. This is sensitive to
earlier allocations during interpreter init and can appear or
disappear with seemingly unrelated changes.

Either change alone is sufficient to fix the specific issue, but both
are worthwhile to avoid similar problems in the future.

(cherry picked from commit 6577d870b0)
This commit is contained in:
Sam Gross 2026-03-31 15:20:24 -04:00 committed by GitHub
parent 25b48b84b8
commit 6ea4f842fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 1657 additions and 1600 deletions

File diff suppressed because it is too large Load diff