comparison src/share/vm/runtime/arguments.cpp @ 886:061cd4d965fc

6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG Summary: Use NewRatio if it is explicitly set. Reviewed-by: ysr, jcoomes
author jmasa
date Sun, 02 Aug 2009 18:44:36 -0700
parents df6caf649ff7
children 82bd76d4d7f2
comparison
equal deleted inserted replaced
885:7f807f55161a 886:061cd4d965fc
1052 const size_t preferred_max_new_size = 1052 const size_t preferred_max_new_size =
1053 align_size_up(preferred_max_new_size_unaligned, os::vm_page_size()); 1053 align_size_up(preferred_max_new_size_unaligned, os::vm_page_size());
1054 1054
1055 // Unless explicitly requested otherwise, size young gen 1055 // Unless explicitly requested otherwise, size young gen
1056 // for "short" pauses ~ 4M*ParallelGCThreads 1056 // for "short" pauses ~ 4M*ParallelGCThreads
1057 if (FLAG_IS_DEFAULT(MaxNewSize)) { // MaxNewSize not set at command-line 1057
1058 // If either MaxNewSize or NewRatio is set on the command line,
1059 // assume the user is trying to set the size of the young gen.
1060
1061 if (FLAG_IS_DEFAULT(MaxNewSize) && FLAG_IS_DEFAULT(NewRatio)) {
1062
1063 // Set MaxNewSize to our calculated preferred_max_new_size unless
1064 // NewSize was set on the command line and it is larger than
1065 // preferred_max_new_size.
1058 if (!FLAG_IS_DEFAULT(NewSize)) { // NewSize explicitly set at command-line 1066 if (!FLAG_IS_DEFAULT(NewSize)) { // NewSize explicitly set at command-line
1059 FLAG_SET_ERGO(uintx, MaxNewSize, MAX2(NewSize, preferred_max_new_size)); 1067 FLAG_SET_ERGO(uintx, MaxNewSize, MAX2(NewSize, preferred_max_new_size));
1060 } else { 1068 } else {
1061 FLAG_SET_ERGO(uintx, MaxNewSize, preferred_max_new_size); 1069 FLAG_SET_ERGO(uintx, MaxNewSize, preferred_max_new_size);
1062 } 1070 }
1063 if(PrintGCDetails && Verbose) { 1071 if(PrintGCDetails && Verbose) {
1064 // Too early to use gclog_or_tty 1072 // Too early to use gclog_or_tty
1065 tty->print_cr("Ergo set MaxNewSize: " SIZE_FORMAT, MaxNewSize); 1073 tty->print_cr("Ergo set MaxNewSize: " SIZE_FORMAT, MaxNewSize);
1066 } 1074 }
1067 } 1075
1068 // Unless explicitly requested otherwise, prefer a large 1076 // Unless explicitly requested otherwise, prefer a large
1069 // Old to Young gen size so as to shift the collection load 1077 // Old to Young gen size so as to shift the collection load
1070 // to the old generation concurrent collector 1078 // to the old generation concurrent collector
1071 if (FLAG_IS_DEFAULT(NewRatio)) { 1079
1080 // If this is only guarded by FLAG_IS_DEFAULT(NewRatio)
1081 // then NewSize and OldSize may be calculated. That would
1082 // generally lead to some differences with ParNewGC for which
1083 // there was no obvious reason. Also limit to the case where
1084 // MaxNewSize has not been set.
1085
1072 FLAG_SET_ERGO(intx, NewRatio, MAX2(NewRatio, new_ratio)); 1086 FLAG_SET_ERGO(intx, NewRatio, MAX2(NewRatio, new_ratio));
1073 1087
1074 size_t min_new = align_size_up(ScaleForWordSize(min_new_default), os::vm_page_size()); 1088 // Code along this path potentially sets NewSize and OldSize
1089
1090 // Calculate the desired minimum size of the young gen but if
1091 // NewSize has been set on the command line, use it here since
1092 // it should be the final value.
1093 size_t min_new;
1094 if (FLAG_IS_DEFAULT(NewSize)) {
1095 min_new = align_size_up(ScaleForWordSize(min_new_default),
1096 os::vm_page_size());
1097 } else {
1098 min_new = NewSize;
1099 }
1075 size_t prev_initial_size = initial_heap_size(); 1100 size_t prev_initial_size = initial_heap_size();
1076 if (prev_initial_size != 0 && prev_initial_size < min_new+OldSize) { 1101 if (prev_initial_size != 0 && prev_initial_size < min_new+OldSize) {
1077 set_initial_heap_size(min_new+OldSize); 1102 set_initial_heap_size(min_new+OldSize);
1078 // Currently minimum size and the initial heap sizes are the same. 1103 // Currently minimum size and the initial heap sizes are the same.
1079 set_min_heap_size(initial_heap_size()); 1104 set_min_heap_size(initial_heap_size());
1081 warning("Initial heap size increased to " SIZE_FORMAT " M from " 1106 warning("Initial heap size increased to " SIZE_FORMAT " M from "
1082 SIZE_FORMAT " M; use -XX:NewSize=... for finer control.", 1107 SIZE_FORMAT " M; use -XX:NewSize=... for finer control.",
1083 initial_heap_size()/M, prev_initial_size/M); 1108 initial_heap_size()/M, prev_initial_size/M);
1084 } 1109 }
1085 } 1110 }
1111
1086 // MaxHeapSize is aligned down in collectorPolicy 1112 // MaxHeapSize is aligned down in collectorPolicy
1087 size_t max_heap = align_size_down(MaxHeapSize, 1113 size_t max_heap =
1088 CardTableRS::ct_max_alignment_constraint()); 1114 align_size_down(MaxHeapSize,
1115 CardTableRS::ct_max_alignment_constraint());
1089 1116
1090 if(PrintGCDetails && Verbose) { 1117 if(PrintGCDetails && Verbose) {
1091 // Too early to use gclog_or_tty 1118 // Too early to use gclog_or_tty
1092 tty->print_cr("CMS set min_heap_size: " SIZE_FORMAT 1119 tty->print_cr("CMS set min_heap_size: " SIZE_FORMAT
1093 " initial_heap_size: " SIZE_FORMAT 1120 " initial_heap_size: " SIZE_FORMAT
1148 else { 1175 else {
1149 // OldPLABSize and CMSParPromoteBlocksToClaim are both set. 1176 // OldPLABSize and CMSParPromoteBlocksToClaim are both set.
1150 // CMSParPromoteBlocksToClaim is a collector-specific flag, so 1177 // CMSParPromoteBlocksToClaim is a collector-specific flag, so
1151 // we'll let it to take precedence. 1178 // we'll let it to take precedence.
1152 jio_fprintf(defaultStream::error_stream(), 1179 jio_fprintf(defaultStream::error_stream(),
1153 "Both OldPLABSize and CMSParPromoteBlocksToClaim options are specified " 1180 "Both OldPLABSize and CMSParPromoteBlocksToClaim"
1154 "for the CMS collector. CMSParPromoteBlocksToClaim will take precedence.\n"); 1181 " options are specified for the CMS collector."
1182 " CMSParPromoteBlocksToClaim will take precedence.\n");
1155 } 1183 }
1156 } 1184 }
1157 } 1185 }
1158 1186
1159 inline uintx max_heap_for_compressed_oops() { 1187 inline uintx max_heap_for_compressed_oops() {