-
Notifications
You must be signed in to change notification settings - Fork 69
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
Do not do any significant amount of work in Release
#1147
Comments
It raises another question: If |
github-merge-queue bot
pushed a commit
that referenced
this issue
Jun 28, 2024
This PR re-introduce the `SweepChunk` work packet to the native `MarkSweepSpace` when using eager sweeping. The main intention of this PS is fixing a pathological case where there is only one mutator and the single `ReleaseMutator` work packet cannot be parallelized. The algorithm is unchanged for lazy sweeping. When doing eager sweeping, 1. We first release all unmarked blocks in `MarkSweepSpace::abandoned` and each mutator. 2. And then we sweep blocks in parallel using `SweepChunk` work packets. 3. We then go through all "consumed" blocks and move them into "available" lists if they have any free cells. In step (1), we release blocks for each mutator in `ReleaseMutator`. Releasing blocks is very fast, so parallelism is not a bottleneck. During step (2), all blocks are either unallocated or marked, so we don't need to move any block out of linked lists, avoiding the data race we observed in #1103. Step (3) is done by one thread, but it is fast enough not to be a performance bottleneck. We also introduced a work packet `ReleaseMarkSweepSpace` which does what `MarkSweepSpace::release` did, but is executed concurrently with `ReleaseMutator` work packets. In this way, we don't do too much work in the `Release` work packet, which is a problem we discussed in #1147. We removed the constant `ABANDON_BLOCKS_IN_RESET` because it is obviously necessary to do so. Otherwise one mutator will keep too many blocks locally, preventing other mutators to get available blocks to use. We added an USDT tracepoint in `SweepChunk` in both `MarkSweepSpace` and `ImmixSpace` so that we can see the number of allocated blocks a `SweepChunk` work packet visited in the timeline generated by eBPF tracing tools. We also changed `immixspace::SweepChunk` so that it now *asserts* that the chunk is allocated rather than skipping unallocated chunks. `ChunkMap::generate_tasks` already filters out unallocated chunks. Fixes: #1146
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In #1146, we observed that when using the native MarkSweep and the eager sweeping is enabled, no
ReleaseMutator
work packet is executed untilRelease
finishes. It can be seen from the eBPF timeline:That is because the
Release
work packet callsPlan::release
before spawning anyReleaseMutator
work packet. See:mmtk-core/src/scheduler/gc_work.rs
Lines 126 to 154 in 401803c
This is not a bug, because
Release
is designed to have exclusive access to thePlan
when executed. This means we shouldn't do any high-intensity work inPlan::release
unless we don't need to release mutators.This affects all plans.
MarkSweep
does a non-trivial amount of work inPlan::release
when doing eager sweeping.Here is a zoomed-in timeline for Immix.
ImmixSpace.release
generatesSweepChunk
work packets, so they start executing beforeReleaseMutator
work packets start.This is SemiSpace:
It looks OK. But after I turn on the VO bits:
Clearly the
Release
work packet is spending a significant amount of time clearing the VO bit.We should revisit all plans and all spaces, and see if they do any significant amount of work in
Plan.release
andSpace.release
. If they do, they should be off-loaded to dedicated work packets so that they can be parallelized.The text was updated successfully, but these errors were encountered: