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

Introducing Pinned Object Heap #32283

Merged
merged 3 commits into from
Feb 17, 2020
Merged

Introducing Pinned Object Heap #32283

merged 3 commits into from
Feb 17, 2020

Conversation

VSadov
Copy link
Member

@VSadov VSadov commented Feb 14, 2020

  • Not exposed through any API yet.
  • Has some extra test code for stress coverage. Will be removed before merging.

@@ -2427,6 +2431,9 @@ static static_data static_data_table[latency_level_last - latency_level_first +
// gen2
{256*1024, SSIZE_T_MAX, 200000, 0.25f, 1.2f, 1.8f, 100000, 100},
// loh
{3*1024*1024, SSIZE_T_MAX, 0, 0.0f, 1.25f, 4.5f, 0, 0},
// loh
Copy link
Member

@AaronRobinsonMSFT AaronRobinsonMSFT Feb 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be poh? #Resolved

Copy link
Member Author

@VSadov VSadov Feb 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, should be poh.
Initial tuning is copied from loh and may be adjusted further, if needed. The comment should say poh though. #Resolved

@VSadov VSadov changed the title [WIP] Introducing Pinned Object Heap Introducing Pinned Object Heap Feb 14, 2020
@VSadov VSadov marked this pull request as ready for review February 14, 2020 19:28
@VSadov VSadov requested a review from Maoni0 February 14, 2020 19:28
@VSadov
Copy link
Member Author

VSadov commented Feb 14, 2020

I think this is ready for the review.

@VSadov
Copy link
Member Author

VSadov commented Feb 14, 2020

In this iteration I am sending LOH allocations with 50/50 chance to POH - for testing purposes.
That hack will be removed before merging, but it is a good testing strategy for something not yet exposed via APIs.

  • All tests have passed, except lohpin, which is expected to fail if the feature works correctly (since the test measures compaction and we are preventing that when allocation goes into POH).
    Failure in lohpin actually demonstrates that POH works as expected.

  • long running GC tests passed on all platforms (includes Reliability Framework with default settings)

  • I have run stress locally with:

set COMPlus_GCSegmentSize=4000000
set COMPlus_gcServer=1

that passed too with Chk and Ret.

I am fairly confident now that POH works and caused no regressions.

@Maoni0
Copy link
Member

Maoni0 commented Feb 14, 2020

great! I'll be reviewing this over the weekend; I already looked at the changes before so I would expect only small changes.

@VSadov
Copy link
Member Author

VSadov commented Feb 14, 2020

@Maoni0 Thanks! The changes are indeed small, ~200 lines, and fairly mechanical too.

@@ -20,6 +20,7 @@
#include "gcpriv.h"

#define USE_INTROSORT
#define ALLOW_REFERENCES_IN_POH
Copy link
Member

@Maoni0 Maoni0 Feb 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would be better in gcpriv.h which has all the feature related defines. the #define's in gc.cpp are purely implementation related, ie, you wouldn't expect someone to define or define them to enable a feature. #Resolved

{3*1024*1024, SSIZE_T_MAX, 0, 0.0f, 1.25f, 4.5f, 0, 0}
{3*1024*1024, SSIZE_T_MAX, 0, 0.0f, 1.25f, 4.5f, 0, 0},
// poh
// TODO: using same numbers as for LOH. May need to tune this (see: https://github.com/dotnet/runtime/issues/13739)
Copy link
Member

@Maoni0 Maoni0 Feb 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will need to be tuned so you could just say "TODO: tuning PR_link_from_GH #Resolved

@@ -2427,6 +2431,9 @@ static static_data static_data_table[latency_level_last - latency_level_first +
// gen2
{256*1024, SSIZE_T_MAX, 200000, 0.25f, 1.2f, 1.8f, 100000, 100},
// loh
{3*1024*1024, SSIZE_T_MAX, 0, 0.0f, 1.25f, 4.5f, 0, 0},
// loh
// TODO: using same numbers as for LOH. May need to tune this (see: https://github.com/dotnet/runtime/issues/13739)
Copy link
Member

@Maoni0 Maoni0 Feb 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// TODO: using same numbers [](start = 8, length = 27)

same here. #Resolved

dprintf (3, ("Relocating cross generation pointers for large objects on heap %d", heap_number));
mark_through_cards_for_uoh_objects(&gc_heap::relocate_address, loh_generation, TRUE THIS_ARG);
dprintf (3, ("Relocating cross generation pointers for uoh objects on heap %d", heap_number));
for(int i = uoh_start_generation; i < total_generation_count; i++)
Copy link
Member

@Maoni0 Maoni0 Feb 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for(int [](start = 12, length = 7)

nit - formatting, needs a space between for and ( #Resolved

dprintf(3, ("Relocating cross generation pointers for large objects on heap %d", hp->heap_number));
hp->mark_through_cards_for_uoh_objects(&gc_heap::relocate_address, loh_generation, TRUE THIS_ARG);
dprintf(3, ("Relocating cross generation pointers for uoh objects on heap %d", hp->heap_number));
for(int i = uoh_start_generation; i < total_generation_count; i++)
Copy link
Member

@Maoni0 Maoni0 Feb 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for(int i [](start = 16, length = 9)

nit - same formatting, needs space #Resolved

@@ -33472,6 +33575,16 @@ CObjectHeader* gc_heap::allocate_large_object (size_t jsize, uint32_t flags, int
return obj;
}

CObjectHeader* gc_heap::allocate_large_object (size_t jsize, uint32_t flags, int64_t& alloc_bytes)
Copy link
Member

@Maoni0 Maoni0 Feb 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need these 2 methods at all instead of just calling allocate_uoh_object and passing in the right args? #Resolved

@@ -3982,6 +3997,16 @@ class gc_heap
PER_HEAP
alloc_list gen2_alloc_list[NUM_GEN2_ALIST-1];

// TODO: using same numbers as for LOH. May need to tune this (see: https://github.com/dotnet/runtime/issues/13739)
Copy link
Member

@Maoni0 Maoni0 Feb 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// TODO: using same numbers as for LOH. May need to tune [](start = 0, length = 57)

again, this will need to be tuned so I would not say "May need to tune" #Resolved

@Maoni0
Copy link
Member

Maoni0 commented Feb 17, 2020

LGTM aside from some minor comments above! feel free to merge after those are addressed.

@VSadov VSadov merged commit e0a1cf9 into dotnet:master Feb 17, 2020
@VSadov VSadov deleted the poh branch February 17, 2020 15:26
@VSadov
Copy link
Member Author

VSadov commented Feb 17, 2020

Thanks!!

@richlander
Copy link
Member

Adding a link to the design doc for people looking at this PR. I didn't see it in the PR.

https://github.com/dotnet/runtime/blob/master/docs/design/features/PinnedHeap.md

@VSadov
Copy link
Member Author

VSadov commented May 16, 2020

Here is the other PR where POH was made available for use via public APIs:
#33526

Just for reference and to link these two PRs together.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants