Skip to content

Commit

Permalink
add GC selection for dedicated ergonomics profile
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephanie Crater authored and d3r3kk committed Jul 26, 2023
1 parent 66f39a1 commit 9faa7c0
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions src/hotspot/share/gc/shared/gcConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,41 @@ void GCConfig::fail_if_non_included_gc_is_selected() {
}

void GCConfig::select_gc_ergonomically() {
if (os::is_server_class_machine()) {
if (strcmp(ErgonomicsProfile, "shared") == 0) {
if (os::is_server_class_machine()) {
#if INCLUDE_G1GC
FLAG_SET_ERGO_IF_DEFAULT(UseG1GC, true);
FLAG_SET_ERGO_IF_DEFAULT(UseG1GC, true);
#elif INCLUDE_PARALLELGC
FLAG_SET_ERGO_IF_DEFAULT(UseParallelGC, true);
FLAG_SET_ERGO_IF_DEFAULT(UseParallelGC, true);
#elif INCLUDE_SERIALGC
FLAG_SET_ERGO_IF_DEFAULT(UseSerialGC, true);
FLAG_SET_ERGO_IF_DEFAULT(UseSerialGC, true);
#endif
} else {
} else {
#if INCLUDE_SERIALGC
FLAG_SET_ERGO_IF_DEFAULT(UseSerialGC, true);
#endif
}
} else if (strcmp(ErgonomicsProfile, "dedicated") == 0) {
phys_mem = os::physical_memory();
if (os::active_processor_count() <= 1) {
#if INCLUDE_SERIALGC
FLAG_SET_ERGO_IF_DEFAULT(UseSerialGC, true);
FLAG_SET_ERGO_IF_DEFAULT(UseSerialGC, true);
#endif
} else if (phys_mem >= 16*G){
#if INCLUDE_ZGC
FLAG_SET_ERGO_IF_DEFAULT(UseZGC, true);
#endif
} else if (phys_mem > 2048*M){
#if INCLUDE_G1GC
FLAG_SET_ERGO_IF_DEFAULT(UseG1GC, true);
#endif
} else {
#if INCLUDE_PARALLELGC
FLAG_SET_ERGO_IF_DEFAULT(UseParallelGC, true);
#endif
}
} else {
ShouldNotReachHere();
}
}

Expand Down

0 comments on commit 9faa7c0

Please sign in to comment.