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

PrepareChunkMap (mark-sweep) unnecessarily clearing mark bits of all chunks #1144

Closed
wks opened this issue Jun 11, 2024 · 1 comment · Fixed by #1148
Closed

PrepareChunkMap (mark-sweep) unnecessarily clearing mark bits of all chunks #1144

wks opened this issue Jun 11, 2024 · 1 comment · Fixed by #1148

Comments

@wks
Copy link
Collaborator

wks commented Jun 11, 2024

for chunk in self.space.chunk_map.all_chunks() {
side.bzero_metadata(chunk.start(), Chunk::BYTES);
}

Each PrepareChunkMap work packet for native_ms is supposed to initialize the chunk-level metadata for a single chunk. But the code shown above clears the side mark bits for all blocks. This is totally unnecessary, and is taking up a considerable amount of time during a GC.

image

The problem becomes more serious when I changed the native MarkSweepSpace to use BlockPageResource instead of the raw FreeListPageResource. The reason may be that BlockPageResource caches blocks in the block queue, and releases chunks lazily, resulting in a higher number of allocated chunks during each GC.

(p.s. ReleaseMutator becomes faster because BlockPageResource::release_block is lock-free, while FreeListPageResource::release_pages needs a mutex to work, which is bad for parallel GC. See: #1145)

image

It should only clear the side metadata for the single chunk that the work packet is responsible for.

@qinsoon
Copy link
Member

qinsoon commented Jun 11, 2024

Yeah. That code is a clear bug. I guess I simply moved the mark bit clearing code from the plan's prepare to PrepareChunkMap without realizing that PrepareChunkMap is per chunk.

wks added a commit to wks/mmtk-core that referenced this issue Jun 11, 2024
Each PrepareChunkMap work packet (used by native MS) should only clear
the side mark bits of the single chunk it is responsible for.

Fixes: mmtk#1144
github-merge-queue bot pushed a commit that referenced this issue Jun 11, 2024
Each PrepareChunkMap work packet (used by native MS) should only clear
the side mark bits of the single chunk it is responsible for.

Fixes: #1144
@wks wks closed this as completed in #1148 Jun 11, 2024
k-sareen pushed a commit to k-sareen/mmtk-core that referenced this issue Jan 3, 2025
Each PrepareChunkMap work packet (used by native MS) should only clear
the side mark bits of the single chunk it is responsible for.

Fixes: mmtk#1144
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants