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

Allow user to specify independent heap hard limits for different object heaps. #37166

Merged
merged 2 commits into from
Jun 4, 2020

Conversation

cshung
Copy link
Member

@cshung cshung commented May 29, 2020

With the per object heap committed memory tracking available (#36731), now we can provide the configuration switches so that the user can specify exactly how much they want to limit per object heap.

Here are the rules:

  • If the user specifies any one of the COMPLUS_GCHeapHardLimitSOH, COMPLUS_GCHeapHardLimitLOH or COMPLUS_GCHeapHardLimitPOH, he or she must also specify the others (with the exception of COMPLUS_GCHeapHardLimitPOH, which is allowed to be unspecified and assume a default value of 0).

  • If the user did not specifies any one of the COMPLUS_GCHeapHardLimitSOH, COMPLUS_GCHeapHardLimitLOH or COMPLUS_GCHeapHardLimitPOH, then we consider COMPLUS_GCHeapHardLimitSOHPercent, COMPLUS_GCHeapHardLimitLOHPercent or COMPLUS_GCHeapHardLimitPOHPercent. These are the percentage equivalents of the above. A value of 1 for COMPLUS_GCHeapHardLimitSOH means we will use 1% of total physical memory for SOH. An additional validation rule is that these percentages should not less than or equal to 0, or greater than or equal to 100. The sum of them should not be greater than or equal to 100 as well.

If the user specifies wrong input (e.g. specify COMPLUS_GCHeapHardLimitSOH but not COMPLUS_GCHeapHardLimitLOH), then the runtime will fail to initialize with E_INVALIDARG. IMO, I think it is a better idea to fail than to guess for default values). This can be easily relaxed if we wanted, but if we choose otherwise it would be hard to tighten it up due to compatibility constraints.

  • If COMPLUS_GCHeapHardLimit is also specified, then it will be ignored. Any allocation that is done by the GC which is not associated with any object heaps (such as the card table) will not be checked against any limit. (It is assumed that they are insignificant compared with user objects).

I haven't tested it thoroughly yet. I will make sure I include large page in my tests.

@ghost
Copy link

ghost commented May 29, 2020

Tagging subscribers to this area: @Maoni0
Notify danmosemsft if you want to be subscribed.

@Maoni0
Copy link
Member

Maoni0 commented May 29, 2020

if POH is supposed to be 0, you'll need to make sure for large pages, the POH segments are not allocated with large pages. that's in virtual_alloc.

@Maoni0
Copy link
Member

Maoni0 commented May 29, 2020

I would suggest to change the env vars in your commit's description to

COMPlus_GCHeapHardLimitSOH

the casing is important on linux.

another thing is we should also support percentages like hardlimit.

src/coreclr/src/gc/gc.cpp Outdated Show resolved Hide resolved
@cshung cshung force-pushed the public/dev/andrew/split-hard-limit branch from 5634f20 to fa5cc3c Compare June 1, 2020 19:42
@cshung cshung marked this pull request as draft June 1, 2020 19:44
@cshung cshung force-pushed the public/dev/andrew/split-hard-limit branch from fa5cc3c to c755c4c Compare June 1, 2020 21:21
@cshung cshung marked this pull request as ready for review June 1, 2020 21:26
@cshung cshung force-pushed the public/dev/andrew/split-hard-limit branch from c755c4c to 31c1687 Compare June 2, 2020 18:24
src/coreclr/src/gc/gc.cpp Outdated Show resolved Hide resolved
src/coreclr/src/gc/gc.cpp Outdated Show resolved Hide resolved
src/coreclr/src/gc/gc.cpp Outdated Show resolved Hide resolved
src/coreclr/src/gc/gc.cpp Outdated Show resolved Hide resolved
@cshung cshung marked this pull request as draft June 3, 2020 02:21
@cshung cshung force-pushed the public/dev/andrew/split-hard-limit branch 2 times, most recently from d49691f to 904d856 Compare June 3, 2020 19:44
@cshung cshung marked this pull request as ready for review June 3, 2020 19:44
@cshung cshung force-pushed the public/dev/andrew/split-hard-limit branch from 904d856 to f671b0d Compare June 3, 2020 19:47
@cshung cshung force-pushed the public/dev/andrew/split-hard-limit branch from f671b0d to fa5579f Compare June 4, 2020 16:02
Copy link
Member

@Maoni0 Maoni0 left a comment

Choose a reason for hiding this comment

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

LGTM!

@cshung cshung merged commit 57b971b into dotnet:master Jun 4, 2020
@cshung cshung deleted the public/dev/andrew/split-hard-limit branch June 4, 2020 21:02
@ghost ghost locked as resolved and limited conversation to collaborators Dec 9, 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.

3 participants