]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-144438: Fix false sharing between QSBR and tlbc_index (gh-144554)
authorSam Gross <colesbury@gmail.com>
Tue, 17 Feb 2026 16:12:25 +0000 (09:12 -0700)
committerGitHub <noreply@github.com>
Tue, 17 Feb 2026 16:12:25 +0000 (11:12 -0500)
commit6577d870b0cb82baf540f4bcf49c01d68204e468
treede3f3d1a258abb0f7cdb5fbf602c06b572ea26d0
parent1bd8cf9ed26977ac8c5cf3ec0eccdb6e7a3798e4
gh-144438: Fix false sharing between QSBR and tlbc_index (gh-144554)

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.
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