-
Notifications
You must be signed in to change notification settings - Fork 80
Add lock-free BlockPageResource for ImmixSpace #506
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
Conversation
6049468 to
68fef66
Compare
|
Pushing this PR forward as this will likely solve the Immix scalability issue @clairexhuang is looking at. |
qinsoon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am concerned with two things:
- Using
drop()for executing some 'epilogue' code. - We may be able to implement
BlockPageResourceon top of the other page resources, so we do not need to worry about coping with contiguous/discontiguous spaces.
…kPool`, `ReusableBlockPool`, respectively.
caizixian
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wenyuzhao could you run the experiments again with one GC thread? @clairexhuang is seeing some results that the new implementation might be slower than the old one for some benchmarks for low thread counts.
Do you know which benchmarks were slowed down? |
|
Here's the plotty: http://squirrel.anu.edu.au/plotty/claireh/barrier-performance/p/rP6fn3 |
qinsoon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few comments related to the public API changes in this PR. We should try keep our API unchanged unless it is necessary.
The API check CI is now passed. No public API changes were introduced. |
qinsoon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR adds a lock-free block queue and uses it for Immix's clean block allocation (as `BlockPageResource`) and recyclable block allocation (as a reusable block queue). The lock-free block queue has per-thread producer endpoints. Only GC workers can add blocks to the queue. Workers will add the blocks to their thread-local queues first, and flush them to the global pool if the queue is full. Block allocation can only happen at block granularity. The consumers still share a single endpoint. But on block allocation fast-path, the cost is just a simple atomic increment to update the allocation cursor and pop a block. _However, for `BlockPageResource`, considering the current design of `Space.acquire`, it still acquires a lock before calling `pr.get_new_pages`._
This PR adds a lock-free block queue and uses it for Immix's clean block allocation (as
BlockPageResource) and recyclable block allocation (as a reusable block queue).The lock-free block queue has per-thread producer endpoints. Only GC workers can add blocks to the queue. Workers will add the blocks to their thread-local queues first, and flush them to the global pool if the queue is full.
Block allocation can only happen at block granularity. The consumers still share a single endpoint. But on block allocation fast-path, the cost is just a simple atomic increment to update the allocation cursor and pop a block. However, for
BlockPageResource, considering the current design ofSpace.acquire, it still acquires a lock before callingpr.get_new_pages.Performance
Zen 2 12/24 core:
http://squirrel.anu.edu.au/plotty-public/wenyuz/v8/p/4HVaWb
http://squirrel.anu.edu.au/plotty-public/wenyuz/v8/p/JYCRMu (NEW)
TODO