]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-144438: Fix false sharing between QSBR and tlbc_index (gh-144554) (#144923)
authorSam Gross <colesbury@gmail.com>
Tue, 31 Mar 2026 19:20:24 +0000 (15:20 -0400)
committerGitHub <noreply@github.com>
Tue, 31 Mar 2026 19:20:24 +0000 (19:20 +0000)
commit6ea4f842fb699a5cd34ec5bed98e259c47e02ca1
treee0ad77a7372a6c6b389ab74a42c7ad8fb5c348c6
parent25b48b84b85a08384479d2636a01d1d52fa97a6b
[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 6577d870b0cb82baf540f4bcf49c01d68204e468)
Doc/data/python3.14.abi
Include/internal/pycore_qsbr.h
Include/internal/pycore_tstate.h
Misc/NEWS.d/next/Core_and_Builtins/2026-02-06-21-45-52.gh-issue-144438.GI_uB1LR.rst [new file with mode: 0644]
Python/qsbr.c