GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||
GeezerVison is showing github.com — gh-135871: Fix needless spinning in _PyMutex_LockTimed (timeout==0) by jtibbertsma · Pull Request #135872 · python/cpython Conversation
|
|
(Sorry Antoine, hit the wrong button!) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| // Spin for a bit. | ||
| _Py_yield(); | ||
| spin_count++; | ||
| v = _Py_atomic_load_uint8_relaxed(&m->_bits); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This looks like it fixes a logic bug but it also hurts performance
See Tools/lockbench/lockbench.py
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
thanks for the review! I'm convinced, this line reduces throughput on my machine by something like 40% for 8 threads. I think changing else if to if still makes sense though. I updated the PR.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Let's investigate (and fix) the missing load separately
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
…e-135871.50C528.rst
|
Thanks @jtibbertsma for the PR, and @colesbury for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…ongh-135872) The free threading build could spin unnecessarily on `_Py_yield()` if the initial compare and swap failed. (cherry picked from commit cbfaf41) Co-authored-by: Joseph Tibbertsma <[email protected]>
|
Sorry, @jtibbertsma and @colesbury, I could not cleanly backport this to |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-135946 is a backport of this pull request to the 3.14 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-135946 is a backport of this pull request to the 3.14 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
pythongh-135872) The free threading build could spin unnecessarily on `_Py_yield()` if the initial compare and swap failed. (cherry picked from commit cbfaf41) Co-authored-by: Joseph Tibbertsma <[email protected]>
|
GH-135947 is a backport of this pull request to the 3.13 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-135947 is a backport of this pull request to the 3.13 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…zero timeout (gh-135872) (gh-135946) The free threading build could spin unnecessarily on `_Py_yield()` if the initial compare and swap failed. (cherry picked from commit cbfaf41) Co-authored-by: Joseph Tibbertsma <[email protected]>
…zero timeout (gh-135872) (gh-135947) The free threading build could spin unnecessarily on `_Py_yield()` if the initial compare and swap failed. (cherry picked from commit cbfaf41) Co-authored-by: Joseph Tibbertsma <[email protected]>
…ongh-135872) The free threading build could spin unnecessarily on `_Py_yield()` if the initial compare and swap failed.
…ongh-135872) The free threading build could spin unnecessarily on `_Py_yield()` if the initial compare and swap failed.
…ongh-135872) The free threading build could spin unnecessarily on `_Py_yield()` if the initial compare and swap failed.
…ongh-135872) The free threading build could spin unnecessarily on `_Py_yield()` if the initial compare and swap failed.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.