Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-114746: Avoid quadratic behavior in free-threaded GC#114817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
encukou merged 1 commit intopython:mainfromcolesbury:gh-114746-gc
Feb 1, 2024

Conversation

@colesbury
Copy link
Contributor

@colesburycolesbury commentedJan 31, 2024
edited by bedevere-appbot
Loading

The free-threaded build's GC implementation is non-generational, but was scheduled as if it were collecting a young generation leading to quadratic behavior. This increases the minimum threshold and scales it to the number of live objects as we do for the old generation in the default build.

Note that the scheduling is still not thread-safe without the GIL. Those changes will come in later PRs.

A few tests, like "test_sneaky_frame_object" rely on prompt scheduling of the GC. For now, to keep that test passing, we disable the scaled threshold after calls likegc.set_threshold(1, 0, 0).

The free-threaded build's GC implementation is non-generational, but wasscheduled as if it were collecting a young generation leading toquadratic behavior. This increases the minimum threshold and scales itto the number of live objects as we do for the old generation in thedefault build.Note that the scheduling is still not thread-safe without the GIL. Thosechanges will come in later PRs.A few tests, like "test_sneaky_frame_object" rely on prompt schedulingof the GC. For now, to keep that test passing, we disable the scaledthreshold after calls like `gc.set_threshold(1, 0, 0)`.
@colesbury
Copy link
ContributorAuthor

!buildbot nogil

@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by@colesbury for commit66959ca 🤖

The command will test the builders whose names match following regular expression:nogil

The builders matched are:

  • x86-64 MacOS Intel NoGIL PR
  • x86-64 MacOS Intel ASAN NoGIL PR
  • AMD64 Windows Server 2022 NoGIL PR
  • AMD64 Ubuntu NoGIL Refleaks PR
  • AMD64 Ubuntu NoGIL PR
  • ARM64 MacOS M1 Refleaks NoGIL PR
  • ARM64 MacOS M1 NoGIL PR

@colesbury
Copy link
ContributorAuthor

@itamaro - I think this fixes the nogil Windows build bot timeouts.

The "Ubuntu NoGIL Refleaks" buildbot still seems quite slow, but I think that was the case before the GC changes.

itamaro reacted with heart emoji

@encukou
Copy link
Member

Ubuntu refleaks failed with a transient issue, which looks unrelated:

======================================================================ERROR: test_lockf (__main__.FNTLEINTRTest.test_lockf)----------------------------------------------------------------------Traceback (most recent call last):  File "/home/ubuntu/buildarea/pull_request.itamaro-ubuntu-aws.refleak.nogil/build/Lib/test/_test_eintr.py", line 532, in test_lockf    self._lock(fcntl.lockf, "lockf")    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^  File "/home/ubuntu/buildarea/pull_request.itamaro-ubuntu-aws.refleak.nogil/build/Lib/test/_test_eintr.py", line 517, in _lock    raise Exception("failed to sync child in %.1f sec" % dt)Exception: failed to sync child in 300.7 sec

A re-run passed.

But I'm sure the flock issue will come up again, especially when I get around to monitoring re-ran Buildbot tests.
This PR fixes a red buildbot so I'll merge.

@encukouencukou merged commite6d6d5d intopython:mainFeb 1, 2024
@encukou
Copy link
Member

Thank you for the quick fix!

@colesburycolesbury deleted the gh-114746-gc branchFebruary 1, 2024 16:36
aisk pushed a commit to aisk/cpython that referenced this pull requestFeb 11, 2024
…GH-114817)The free-threaded build's GC implementation is non-generational, but wasscheduled as if it were collecting a young generation leading toquadratic behavior. This increases the minimum threshold and scales itto the number of live objects as we do for the old generation in thedefault build.Note that the scheduling is still not thread-safe without the GIL. Thosechanges will come in later PRs.A few tests, like "test_sneaky_frame_object" rely on prompt schedulingof the GC. For now, to keep that test passing, we disable the scaledthreshold after calls like `gc.set_threshold(1, 0, 0)`.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@encukouencukouAwaiting requested review from encukou

@DinoVDinoVAwaiting requested review from DinoV

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@colesbury@bedevere-bot@encukou

[8]ページ先頭

©2009-2025 Movatter.jp