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-99113: A Per-Interpreter GIL! by ericsnowcurrently · Pull Request #99114 · python/cpython Conversation
|
|
318 commits, 114 files, 23 reviewers… How are we going to do this? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
We can create a separate PR that just defines a no-op slot Thanks to it, this PR will become a much smaller follow-up. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Not sure how that happened — I only meant to remove my own request for review... |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Actually, most of the changed files are repetitive, trivial updates of various extension module's PyModuleDef structs. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Their repetitiveness takes attention from other parts of the diff and requires to constantly scroll through all of them for each inter-file comparison in other parts of the PR. It makes the analysis harder. That's why I proposed to move them out into a separate PR, merge it and update this PR. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I quickly went through and marked all those files as "Viewed", then used the File Filter drop down to hide viewed files. So I've only got 7 files left with non-trivial changes, one of which is the NEWS entry. Looks like the "viewed" state is remembered, but the filter needs to be set each time I go back in. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| const PyInterpreterConfig config = _PyInterpreterConfig_LEGACY_INIT; | ||
| PyInterpreterConfig config = _PyInterpreterConfig_LEGACY_INIT; | ||
| // The main interpreter always has its own GIL. | ||
| config.own_gil = 1; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Presumably we're in a lot of trouble if the main interpreter exits first...
Do we have mechanisms to ensure it outlives any subinterpreters that share its GIL? Or perhaps we should reference count the GIL instead of marking ownership?
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.
Yeah, the main interpreter must be the last one. There are many things that break if that isn't the case.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| PyInterpreterState *interp = _PyInterpreterState_Get(); | ||
| struct _gil_runtime_state *gil = interp->ceval.gil; | ||
| assert(gil != NULL); | ||
| gil->interval = microseconds; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Do we need some way to propagate this to new subinterpreters? I don't see it if it's here.
Not sure whether this would catch people out or not. Presumably increasing the switch count is less important with proper parallelism, and it's documented as setting "the interpreter's switch interval" so we're clear on that front. But it may be surprising.
Probably only worth adding a note to the sys docs to clarify that it doesn't propagate to new subinterpreter GILs.
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.
Yeah, we'll make sure the docs are clear.
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.
I've left a TODO note on the issue: #99113 (comment).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I had seriously considered splitting this PR up yesterday. I should have listened to myself. 🙂 I'm going to split it up. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I've noted the new PRs above in the PR summary. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…pythongh-104148) I'll be adding a value to indicate support for per-interpreter GIL in pythongh-99114.
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.