--- old/src/share/vm/gc/shared/workgroup.cpp 2016-07-20 13:16:02.708290512 -0700 +++ new/src/share/vm/gc/shared/workgroup.cpp 2016-07-20 13:16:02.580290516 -0700 @@ -271,11 +271,13 @@ "Trying to execute task %s with %u workers which is more than the amount of total workers %u.", task->name(), num_workers, total_workers()); guarantee(num_workers > 0, "Trying to execute task %s with zero workers", task->name()); - // num_workers may have been calculated based on different criteria - // than _active_workers so use num_workers limited by the number of - // created workers. - uint active_workers = MIN2(_created_workers, num_workers); - _dispatcher->coordinator_execute_on_workers(task, active_workers); + uint old_num_workers = _active_workers; + log_debug(gc)("run_task: updating active workers for %s from %u to %u", task->name(), old_num_workers, num_workers); + update_active_workers(num_workers); + guarantee(_active_workers == num_workers, "active workers %u num_workers %u", _active_workers, num_workers); + _dispatcher->coordinator_execute_on_workers(task, num_workers); + log_debug(gc)("run_task: restoring active workers from %u to %u", num_workers, old_num_workers); + update_active_workers(old_num_workers); } AbstractGangWorker::AbstractGangWorker(AbstractWorkGang* gang, uint id) {