hotspot/src/share/vm/runtime/vm_version.cpp
changeset 38175 4e2bff1a5467
parent 37430 fd743dadef12
child 38241 32eab2eb41fd
equal deleted inserted replaced
38174:f611c50b8703 38175:4e2bff1a5467
   287                                                       unsigned int num,
   287                                                       unsigned int num,
   288                                                       unsigned int den,
   288                                                       unsigned int den,
   289                                                       unsigned int switch_pt) {
   289                                                       unsigned int switch_pt) {
   290   if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
   290   if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
   291     assert(ParallelGCThreads == 0, "Default ParallelGCThreads is not 0");
   291     assert(ParallelGCThreads == 0, "Default ParallelGCThreads is not 0");
       
   292     unsigned int threads;
   292     // For very large machines, there are diminishing returns
   293     // For very large machines, there are diminishing returns
   293     // for large numbers of worker threads.  Instead of
   294     // for large numbers of worker threads.  Instead of
   294     // hogging the whole system, use a fraction of the workers for every
   295     // hogging the whole system, use a fraction of the workers for every
   295     // processor after the first 8.  For example, on a 72 cpu machine
   296     // processor after the first 8.  For example, on a 72 cpu machine
   296     // and a chosen fraction of 5/8
   297     // and a chosen fraction of 5/8
   297     // use 8 + (72 - 8) * (5/8) == 48 worker threads.
   298     // use 8 + (72 - 8) * (5/8) == 48 worker threads.
   298     unsigned int ncpus = (unsigned int) os::active_processor_count();
   299     unsigned int ncpus = (unsigned int) os::active_processor_count();
   299     return (ncpus <= switch_pt) ?
   300     threads = (ncpus <= switch_pt) ?
   300            ncpus :
   301              ncpus :
   301           (switch_pt + ((ncpus - switch_pt) * num) / den);
   302              (switch_pt + ((ncpus - switch_pt) * num) / den);
       
   303 #ifndef _LP64
       
   304     // On 32-bit binaries the virtual address space available to the JVM
       
   305     // is usually limited to 2-3 GB (depends on the platform).
       
   306     // Do not use up address space with too many threads (stacks and per-thread
       
   307     // data). Note that x86 apps running on Win64 have 2 stacks per thread.
       
   308     // GC may more generally scale down threads by max heap size (etc), but the
       
   309     // consequences of over-provisioning threads are higher on 32-bit JVMS,
       
   310     // so add hard limit here:
       
   311     threads = MIN2(threads, (2*switch_pt));
       
   312 #endif
       
   313     return threads;
   302   } else {
   314   } else {
   303     return ParallelGCThreads;
   315     return ParallelGCThreads;
   304   }
   316   }
   305 }
   317 }
   306 
   318