comparison src/share/vm/runtime/arguments.cpp @ 13:183f41cf8bfe

6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO Summary: Default values set by cms ergonomics are set with FLAG_SET_DEFAULT so down stream the values look like the default values and affect how later parameters are set. Set these values with FLAG_SET_ERGO instead and adjust how later parameters are interpreted. Reviewed-by: iveresov, apetrusenko, pbk, ysr
author jmasa
date Sun, 02 Mar 2008 16:10:12 -0800
parents 28372612af5e
children 8b6e49187640
comparison
equal deleted inserted replaced
12:6432c3bb6240 13:183f41cf8bfe
998 intx new_ratio; 998 intx new_ratio;
999 size_t min_new_default; 999 size_t min_new_default;
1000 intx tenuring_default; 1000 intx tenuring_default;
1001 if (CMSUseOldDefaults) { // old defaults: "old" as of 6.0 1001 if (CMSUseOldDefaults) { // old defaults: "old" as of 6.0
1002 if FLAG_IS_DEFAULT(CMSYoungGenPerWorker) { 1002 if FLAG_IS_DEFAULT(CMSYoungGenPerWorker) {
1003 FLAG_SET_DEFAULT(CMSYoungGenPerWorker, 4*M); 1003 FLAG_SET_ERGO(intx, CMSYoungGenPerWorker, 4*M);
1004 } 1004 }
1005 young_gen_per_worker = 4*M; 1005 young_gen_per_worker = 4*M;
1006 new_ratio = (intx)15; 1006 new_ratio = (intx)15;
1007 min_new_default = 4*M; 1007 min_new_default = 4*M;
1008 tenuring_default = (intx)0; 1008 tenuring_default = (intx)0;
1023 1023
1024 // Unless explicitly requested otherwise, size young gen 1024 // Unless explicitly requested otherwise, size young gen
1025 // for "short" pauses ~ 4M*ParallelGCThreads 1025 // for "short" pauses ~ 4M*ParallelGCThreads
1026 if (FLAG_IS_DEFAULT(MaxNewSize)) { // MaxNewSize not set at command-line 1026 if (FLAG_IS_DEFAULT(MaxNewSize)) { // MaxNewSize not set at command-line
1027 if (!FLAG_IS_DEFAULT(NewSize)) { // NewSize explicitly set at command-line 1027 if (!FLAG_IS_DEFAULT(NewSize)) { // NewSize explicitly set at command-line
1028 FLAG_SET_DEFAULT(MaxNewSize, MAX2(NewSize, preferred_max_new_size)); 1028 FLAG_SET_ERGO(uintx, MaxNewSize, MAX2(NewSize, preferred_max_new_size));
1029 } else { 1029 } else {
1030 FLAG_SET_DEFAULT(MaxNewSize, preferred_max_new_size); 1030 FLAG_SET_ERGO(uintx, MaxNewSize, preferred_max_new_size);
1031 } 1031 }
1032 if(PrintGCDetails && Verbose) {
1033 // Too early to use gclog_or_tty
1034 tty->print_cr("Ergo set MaxNewSize: " SIZE_FORMAT, MaxNewSize);
1035 }
1032 } 1036 }
1033 // Unless explicitly requested otherwise, prefer a large 1037 // Unless explicitly requested otherwise, prefer a large
1034 // Old to Young gen size so as to shift the collection load 1038 // Old to Young gen size so as to shift the collection load
1035 // to the old generation concurrent collector 1039 // to the old generation concurrent collector
1036 if (FLAG_IS_DEFAULT(NewRatio)) { 1040 if (FLAG_IS_DEFAULT(NewRatio)) {
1037 FLAG_SET_DEFAULT(NewRatio, MAX2(NewRatio, new_ratio)); 1041 FLAG_SET_ERGO(intx, NewRatio, MAX2(NewRatio, new_ratio));
1038 1042
1039 size_t min_new = align_size_up(ScaleForWordSize(min_new_default), os::vm_page_size()); 1043 size_t min_new = align_size_up(ScaleForWordSize(min_new_default), os::vm_page_size());
1040 size_t prev_initial_size = initial_heap_size(); 1044 size_t prev_initial_size = initial_heap_size();
1041 if (prev_initial_size != 0 && prev_initial_size < min_new+OldSize) { 1045 if (prev_initial_size != 0 && prev_initial_size < min_new+OldSize) {
1042 set_initial_heap_size(min_new+OldSize); 1046 set_initial_heap_size(min_new+OldSize);
1050 } 1054 }
1051 // MaxHeapSize is aligned down in collectorPolicy 1055 // MaxHeapSize is aligned down in collectorPolicy
1052 size_t max_heap = align_size_down(MaxHeapSize, 1056 size_t max_heap = align_size_down(MaxHeapSize,
1053 CardTableRS::ct_max_alignment_constraint()); 1057 CardTableRS::ct_max_alignment_constraint());
1054 1058
1059 if(PrintGCDetails && Verbose) {
1060 // Too early to use gclog_or_tty
1061 tty->print_cr("CMS set min_heap_size: " SIZE_FORMAT
1062 " initial_heap_size: " SIZE_FORMAT
1063 " max_heap: " SIZE_FORMAT,
1064 min_heap_size(), initial_heap_size(), max_heap);
1065 }
1055 if (max_heap > min_new) { 1066 if (max_heap > min_new) {
1056 // Unless explicitly requested otherwise, make young gen 1067 // Unless explicitly requested otherwise, make young gen
1057 // at least min_new, and at most preferred_max_new_size. 1068 // at least min_new, and at most preferred_max_new_size.
1058 if (FLAG_IS_DEFAULT(NewSize)) { 1069 if (FLAG_IS_DEFAULT(NewSize)) {
1059 FLAG_SET_DEFAULT(NewSize, MAX2(NewSize, min_new)); 1070 FLAG_SET_ERGO(uintx, NewSize, MAX2(NewSize, min_new));
1060 FLAG_SET_DEFAULT(NewSize, MIN2(preferred_max_new_size, NewSize)); 1071 FLAG_SET_ERGO(uintx, NewSize, MIN2(preferred_max_new_size, NewSize));
1072 if(PrintGCDetails && Verbose) {
1073 // Too early to use gclog_or_tty
1074 tty->print_cr("Ergo set NewSize: " SIZE_FORMAT, NewSize);
1075 }
1061 } 1076 }
1062 // Unless explicitly requested otherwise, size old gen 1077 // Unless explicitly requested otherwise, size old gen
1063 // so that it's at least 3X of NewSize to begin with; 1078 // so that it's at least 3X of NewSize to begin with;
1064 // later NewRatio will decide how it grows; see above. 1079 // later NewRatio will decide how it grows; see above.
1065 if (FLAG_IS_DEFAULT(OldSize)) { 1080 if (FLAG_IS_DEFAULT(OldSize)) {
1066 if (max_heap > NewSize) { 1081 if (max_heap > NewSize) {
1067 FLAG_SET_DEFAULT(OldSize, MIN2(3*NewSize, max_heap - NewSize)); 1082 FLAG_SET_ERGO(uintx, OldSize, MIN2(3*NewSize, max_heap - NewSize));
1083 if(PrintGCDetails && Verbose) {
1084 // Too early to use gclog_or_tty
1085 tty->print_cr("Ergo set OldSize: " SIZE_FORMAT, OldSize);
1086 }
1068 } 1087 }
1069 } 1088 }
1070 } 1089 }
1071 } 1090 }
1072 // Unless explicitly requested otherwise, definitely 1091 // Unless explicitly requested otherwise, definitely
1073 // promote all objects surviving "tenuring_default" scavenges. 1092 // promote all objects surviving "tenuring_default" scavenges.
1074 if (FLAG_IS_DEFAULT(MaxTenuringThreshold) && 1093 if (FLAG_IS_DEFAULT(MaxTenuringThreshold) &&
1075 FLAG_IS_DEFAULT(SurvivorRatio)) { 1094 FLAG_IS_DEFAULT(SurvivorRatio)) {
1076 FLAG_SET_DEFAULT(MaxTenuringThreshold, tenuring_default); 1095 FLAG_SET_ERGO(intx, MaxTenuringThreshold, tenuring_default);
1077 } 1096 }
1078 // If we decided above (or user explicitly requested) 1097 // If we decided above (or user explicitly requested)
1079 // `promote all' (via MaxTenuringThreshold := 0), 1098 // `promote all' (via MaxTenuringThreshold := 0),
1080 // prefer minuscule survivor spaces so as not to waste 1099 // prefer minuscule survivor spaces so as not to waste
1081 // space for (non-existent) survivors 1100 // space for (non-existent) survivors
1082 if (FLAG_IS_DEFAULT(SurvivorRatio) && MaxTenuringThreshold == 0) { 1101 if (FLAG_IS_DEFAULT(SurvivorRatio) && MaxTenuringThreshold == 0) {
1083 FLAG_SET_DEFAULT(SurvivorRatio, MAX2((intx)1024, SurvivorRatio)); 1102 FLAG_SET_ERGO(intx, SurvivorRatio, MAX2((intx)1024, SurvivorRatio));
1084 } 1103 }
1085 // If OldPLABSize is set and CMSParPromoteBlocksToClaim is not, 1104 // If OldPLABSize is set and CMSParPromoteBlocksToClaim is not,
1086 // set CMSParPromoteBlocksToClaim equal to OldPLABSize. 1105 // set CMSParPromoteBlocksToClaim equal to OldPLABSize.
1087 // This is done in order to make ParNew+CMS configuration to work 1106 // This is done in order to make ParNew+CMS configuration to work
1088 // with YoungPLABSize and OldPLABSize options. 1107 // with YoungPLABSize and OldPLABSize options.
1089 // See CR 6362902. 1108 // See CR 6362902.
1090 if (!FLAG_IS_DEFAULT(OldPLABSize)) { 1109 if (!FLAG_IS_DEFAULT(OldPLABSize)) {
1091 if (FLAG_IS_DEFAULT(CMSParPromoteBlocksToClaim)) { 1110 if (FLAG_IS_DEFAULT(CMSParPromoteBlocksToClaim)) {
1092 FLAG_SET_CMDLINE(uintx, CMSParPromoteBlocksToClaim, OldPLABSize); 1111 // OldPLABSize is not the default value but CMSParPromoteBlocksToClaim
1112 // is. In this situtation let CMSParPromoteBlocksToClaim follow
1113 // the value (either from the command line or ergonomics) of
1114 // OldPLABSize. Following OldPLABSize is an ergonomics decision.
1115 FLAG_SET_ERGO(uintx, CMSParPromoteBlocksToClaim, OldPLABSize);
1093 } 1116 }
1094 else { 1117 else {
1095 // OldPLABSize and CMSParPromoteBlocksToClaim are both set. 1118 // OldPLABSize and CMSParPromoteBlocksToClaim are both set.
1096 // CMSParPromoteBlocksToClaim is a collector-specific flag, so 1119 // CMSParPromoteBlocksToClaim is a collector-specific flag, so
1097 // we'll let it to take precedence. 1120 // we'll let it to take precedence.
1209 } 1232 }
1210 } 1233 }
1211 1234
1212 if (UseParallelOldGC) { 1235 if (UseParallelOldGC) {
1213 // Par compact uses lower default values since they are treated as 1236 // Par compact uses lower default values since they are treated as
1214 // minimums. 1237 // minimums. These are different defaults because of the different
1238 // interpretation and are not ergonomically set.
1215 if (FLAG_IS_DEFAULT(MarkSweepDeadRatio)) { 1239 if (FLAG_IS_DEFAULT(MarkSweepDeadRatio)) {
1216 MarkSweepDeadRatio = 1; 1240 FLAG_SET_DEFAULT(MarkSweepDeadRatio, 1);
1217 } 1241 }
1218 if (FLAG_IS_DEFAULT(PermMarkSweepDeadRatio)) { 1242 if (FLAG_IS_DEFAULT(PermMarkSweepDeadRatio)) {
1219 PermMarkSweepDeadRatio = 5; 1243 FLAG_SET_DEFAULT(PermMarkSweepDeadRatio, 5);
1220 } 1244 }
1221 } 1245 }
1222 } 1246 }
1223 } 1247 }
1224 1248
2450 // Check the GC selections again. 2474 // Check the GC selections again.
2451 if (!check_gc_consistency()) { 2475 if (!check_gc_consistency()) {
2452 return JNI_EINVAL; 2476 return JNI_EINVAL;
2453 } 2477 }
2454 2478
2455 if (UseParallelGC) { 2479 if (UseParallelGC || UseParallelOldGC) {
2456 // Set some flags for ParallelGC if needed. 2480 // Set some flags for ParallelGC if needed.
2457 set_parallel_gc_flags(); 2481 set_parallel_gc_flags();
2458 } else if (UseConcMarkSweepGC) { 2482 } else if (UseConcMarkSweepGC) {
2459 // Set some flags for CMS 2483 // Set some flags for CMS
2460 set_cms_and_parnew_gc_flags(); 2484 set_cms_and_parnew_gc_flags();