Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

julia_gc: fix detection of already scanned root task #5726

Merged
merged 1 commit into from
May 28, 2024

Conversation

fingolfin
Copy link
Member

We already scan some stack during as part of the GapRootScanner callback, which usually will be the stack of the active task of the main thread. As an optimization, we want to avoid scanning that task's thread a second time in GapTaskScanner.

We used to do that by checking in the latter whether the task about to be scanned is the current task. But that is wrong: the task may be different for all kinds of reasons, most notably if there are multiple GC threads active.

So instead, just record the task we scanned in GapRootScanner (this is safe to write as there is single thread involved at this point) and then compare against that in GapTaskScanner (which may be called concurrently from multiple threads).

@fingolfin fingolfin added topic: kernel release notes: not needed PRs introducing changes that are wholly irrelevant to the release notes topic: julia Julia GC integration and related matters backport-to-4.13 labels May 27, 2024
@fingolfin fingolfin requested a review from ChrisJefferson May 27, 2024 10:09
We already scan some stack during as part of the `GapRootScanner`
callback, which usually will be the stack of the active task of
the main thread. As an optimization, we want to avoid scanning
that task's thread a second time in `GapTaskScanner`.

We used to do that by checking in the latter whether the task
about to be scanned is the current task. But that is wrong:
the task may be different for all kinds of reasons, most notably
if there are multiple GC threads active.

So instead, just record the task we scanned in `GapRootScanner`
(this is safe to write as there is single thread involved at this
point) and then compare against that in `GapTaskScanner` (which
may be called concurrently from multiple threads).
@fingolfin fingolfin force-pushed the mh/julia_gc_root_task branch from 4084a56 to 479cab2 Compare May 27, 2024 10:12
@fingolfin fingolfin merged commit 93d7ee3 into gap-system:master May 28, 2024
22 checks passed
@fingolfin fingolfin deleted the mh/julia_gc_root_task branch May 28, 2024 04:41
@fingolfin fingolfin changed the title julia_gc: fix detection of already canned root task julia_gc: fix detection of already scanned root task May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-to-4.13-DONE release notes: not needed PRs introducing changes that are wholly irrelevant to the release notes topic: julia Julia GC integration and related matters topic: kernel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants