Content-Length: 323736 | pFad | https://github.com/python/cpython/pull/144923

A2 [3.14] gh-144438: Fix false sharing between QSBR and tlbc_index (gh-144554) by colesbury · Pull Request #144923 · python/cpython · GitHub
Skip to content

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

Merged
colesbury merged 3 commits intopython:3.14from
colesbury:backport-6577d87-3.14
Mar 31, 2026
Merged

[3.14] gh-144438: Fix false sharing between QSBR and tlbc_index (gh-144554)#144923
colesbury merged 3 commits intopython:3.14from
colesbury:backport-6577d87-3.14

Conversation

@colesbury
Copy link
Copy Markdown
Contributor

@colesbury colesbury commented Feb 17, 2026

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 6577d87)

…pythongh-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.
(cherry picked from commit 6577d87)

Co-authored-by: Sam Gross <colesbury@gmail.com>
@colesbury colesbury marked this pull request as ready for review February 17, 2026 18:06
@colesbury colesbury requested a review from hugovk February 17, 2026 18:06
@colesbury
Copy link
Copy Markdown
Contributor Author

Added @hugovk for _PyRuntime size change due to field in struct _qsbr_shared

@hugovk
Copy link
Copy Markdown
Member

hugovk commented Mar 30, 2026

Okay to merge for 3.14, please resolve conflicts.

@colesbury colesbury enabled auto-merge (squash) March 31, 2026 12:34
@colesbury colesbury merged commit 6ea4f84 into python:3.14 Mar 31, 2026
86 of 88 checks passed
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









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/python/cpython/pull/144923

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy