changeset 40012:f69cfe79fe98

8161993: G1 crashes if active_processor_count changes during startup Summary: Use the initial active processor count for memory initialization instead of the current active one. Reviewed-by: dholmes, mgerdin
author tschatzl
date Tue, 26 Jul 2016 11:04:20 +0200
parents e93911497588
children 943cf01a6b82
files hotspot/src/share/vm/gc/g1/dirtyCardQueue.cpp hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp hotspot/src/share/vm/runtime/vm_version.cpp
diffstat 3 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/src/share/vm/gc/g1/dirtyCardQueue.cpp	Tue Jul 26 11:04:20 2016 +0200
+++ b/hotspot/src/share/vm/gc/g1/dirtyCardQueue.cpp	Tue Jul 26 11:04:20 2016 +0200
@@ -122,7 +122,7 @@
 
 // Determines how many mutator threads can process the buffers in parallel.
 uint DirtyCardQueueSet::num_par_ids() {
-  return (uint)os::processor_count();
+  return (uint)os::initial_active_processor_count();
 }
 
 void DirtyCardQueueSet::initialize(CardTableEntryClosure* cl,
--- a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp	Tue Jul 26 11:04:20 2016 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp	Tue Jul 26 11:04:20 2016 +0200
@@ -416,11 +416,10 @@
     double overall_cm_overhead =
       (double) MaxGCPauseMillis * marking_overhead /
       (double) GCPauseIntervalMillis;
-    double cpu_ratio = 1.0 / (double) os::processor_count();
+    double cpu_ratio = 1.0 / os::initial_active_processor_count();
     double marking_thread_num = ceil(overall_cm_overhead / cpu_ratio);
     double marking_task_overhead =
-      overall_cm_overhead / marking_thread_num *
-                                              (double) os::processor_count();
+      overall_cm_overhead / marking_thread_num * os::initial_active_processor_count();
     double sleep_factor =
                        (1.0 - marking_task_overhead) / marking_task_overhead;
 
--- a/hotspot/src/share/vm/runtime/vm_version.cpp	Tue Jul 26 11:04:20 2016 +0200
+++ b/hotspot/src/share/vm/runtime/vm_version.cpp	Tue Jul 26 11:04:20 2016 +0200
@@ -295,7 +295,7 @@
     // processor after the first 8.  For example, on a 72 cpu machine
     // and a chosen fraction of 5/8
     // use 8 + (72 - 8) * (5/8) == 48 worker threads.
-    unsigned int ncpus = (unsigned int) os::active_processor_count();
+    unsigned int ncpus = (unsigned int) os::initial_active_processor_count();
     threads = (ncpus <= switch_pt) ?
              ncpus :
              (switch_pt + ((ncpus - switch_pt) * num) / den);