-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
GC bookkeeping data structure in-place commit #52402
Conversation
Tagging subscribers to this area: @dotnet/gc Issue DetailsWith a fixed reserved range in the This is a work-in-progress - the goal of this PR right now is looking for early feedback only. Highlights:
Lowlights:
|
I would definitely not use the flat a, b, c.... to keep track of layout. it seems awkward. you can have an enum for each type of element the bookkeeping has and an array that keeps track of where each one starts in the array and commit as needed. pseudo code -
for initial reserve (you do need to commit the first page for card_table_info) you can call calc_bookkeeping_element_size, get the total size and populate committed for each one without actually committing. |
60552e8
to
8415ff8
Compare
I don't think you need to do this under a lock unless you are using an OS with a memory manager that can't commit already committed memory like on Nintendo Switch (both windows and linux can handle it just now). you could have 2 threads both commit up to their used, then use an interlocked compare exchange to update used to a new value. also you are not using the same policy as grow_brick_card_tables which is to extend it more than strictly needed to avoid having to commit again. I think that's a good policy that should be kept especially in the region case as we get regions a lot more frequently than segments. |
As per offline discussion, this is non-trivial and we can always optimize later.
It is done. |
b38fd23
to
a54b8b5
Compare
26407b0
to
30a057b
Compare
this looks good to me in general. as we discussed, please verify for segments, all the sizes/alignments (reserved/committed) should be the same except for |
…per alignment sizes
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!
With a fixed reserved range in the
USE_REGIONS
case, we can simplify the logic for managing the GC bookkeeping data structures as we grow the heap by doing so in place.Highlights:
USE_REGIONS
case, the data structures are committing much less memory than it was.STRESS_REGIONS
, at random times, the data structure is committed right at the level it needs to stress size computation logic.virtual_commit
are page-aligned.Lowlights:
g_mark_list_piece
, it will be done in follow-up PRs.g_gc_highest_address
value, it seems unnecessary for the x64 case.