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.
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: https://github.com/mmtk/mmtk-core/issues/1145)
It should only clear the side metadata for the single chunk that the work packet is responsible for.
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.
https://github.com/mmtk/mmtk-core/blob/401803ce44d851c19e4d04f152b494095f9b71e6/src/policy/marksweepspace/native_ms/global.rs#L435-L437
Each
PrepareChunkMap
work packet fornative_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.The problem becomes more serious when I changed the native
MarkSweepSpace
to useBlockPageResource
instead of the rawFreeListPageResource
. The reason may be thatBlockPageResource
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 becauseBlockPageResource::release_block
is lock-free, whileFreeListPageResource::release_pages
needs a mutex to work, which is bad for parallel GC. See: https://github.com/mmtk/mmtk-core/issues/1145)It should only clear the side metadata for the single chunk that the work packet is responsible for.