hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp
changeset 40096 246c62cd9180
parent 40012 f69cfe79fe98
child 40655 9f644073d3a0
--- a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp	Fri Jul 29 08:17:43 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp	Wed Jun 08 14:11:51 2016 -0700
@@ -1031,11 +1031,14 @@
   uint active_workers = MAX2(1U, parallel_marking_threads());
   assert(active_workers > 0, "Should have been set");
 
+  // Setting active workers is not guaranteed since fewer
+  // worker threads may currently exist and more may not be
+  // available.
+  active_workers = _parallel_workers->update_active_workers(active_workers);
   // Parallel task terminator is set in "set_concurrency_and_phase()"
   set_concurrency_and_phase(active_workers, true /* concurrent */);
 
   G1CMConcurrentMarkingTask markingTask(this, cmThread());
-  _parallel_workers->set_active_workers(active_workers);
   _parallel_workers->run_task(&markingTask);
   print_stats();
 }