comparison src/share/vm/runtime/vm_version.cpp @ 10:28372612af5e

6362677: Change parallel GC collector default number of parallel GC threads. Summary: Use the same default number of GC threads as used by ParNewGC and ConcMarkSweepGC (i.e., the 5/8th rule). Reviewed-by: ysr, tonyp
author jmasa
date Fri, 22 Feb 2008 17:17:14 -0800
parents a61af66fc99e
children d1605aabd0a1
comparison
equal deleted inserted replaced
9:173195ff483a 10:28372612af5e
50 // <major_ver>.<minor_ver>-b<nn>[-<identifier>][-<debug_target>] 50 // <major_ver>.<minor_ver>-b<nn>[-<identifier>][-<debug_target>]
51 int Abstract_VM_Version::_vm_major_version = 0; 51 int Abstract_VM_Version::_vm_major_version = 0;
52 int Abstract_VM_Version::_vm_minor_version = 0; 52 int Abstract_VM_Version::_vm_minor_version = 0;
53 int Abstract_VM_Version::_vm_build_number = 0; 53 int Abstract_VM_Version::_vm_build_number = 0;
54 bool Abstract_VM_Version::_initialized = false; 54 bool Abstract_VM_Version::_initialized = false;
55 int Abstract_VM_Version::_parallel_worker_threads = 0;
56 bool Abstract_VM_Version::_parallel_worker_threads_initialized = false;
55 57
56 void Abstract_VM_Version::initialize() { 58 void Abstract_VM_Version::initialize() {
57 if (_initialized) { 59 if (_initialized) {
58 return; 60 return;
59 } 61 }
208 if (PrintMiscellaneous && Verbose) { 210 if (PrintMiscellaneous && Verbose) {
209 os::print_cpu_info(tty); 211 os::print_cpu_info(tty);
210 } 212 }
211 #endif 213 #endif
212 } 214 }
215
216 unsigned int Abstract_VM_Version::nof_parallel_worker_threads(
217 unsigned int num,
218 unsigned int den,
219 unsigned int switch_pt) {
220 if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
221 assert(ParallelGCThreads == 0, "Default ParallelGCThreads is not 0");
222 // For very large machines, there are diminishing returns
223 // for large numbers of worker threads. Instead of
224 // hogging the whole system, use a fraction of the workers for every
225 // processor after the first 8. For example, on a 72 cpu machine
226 // and a chosen fraction of 5/8
227 // use 8 + (72 - 8) * (5/8) == 48 worker threads.
228 unsigned int ncpus = (unsigned int) os::active_processor_count();
229 return (ncpus <= switch_pt) ?
230 ncpus :
231 (switch_pt + ((ncpus - switch_pt) * num) / den);
232 } else {
233 return ParallelGCThreads;
234 }
235 }
236
237 unsigned int Abstract_VM_Version::calc_parallel_worker_threads() {
238 return nof_parallel_worker_threads(5, 8, 8);
239 }
240
241
242 // Does not set the _initialized flag since it is
243 // a global flag.
244 unsigned int Abstract_VM_Version::parallel_worker_threads() {
245 if (!_parallel_worker_threads_initialized) {
246 if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
247 _parallel_worker_threads = VM_Version::calc_parallel_worker_threads();
248 } else {
249 _parallel_worker_threads = ParallelGCThreads;
250 }
251 _parallel_worker_threads_initialized = true;
252 }
253 return _parallel_worker_threads;
254 }