< prev index next >

src/share/vm/gc/parallel/gcTaskManager.cpp

Print this page
rev 11460 : refactor: switch to update_active_threads()


 512     int more_inactive_workers = 0;
 513     {
 514       // Stop any idle tasks from exiting their IdleGCTask's
 515       // and get the count for additional IdleGCTask's under
 516       // the GCTaskManager's monitor so that the "more_inactive_workers"
 517       // count is correct.
 518       MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
 519       _wait_helper.set_should_wait(true);
 520       // active_workers are a number being requested.  idle_workers
 521       // are the number currently idle.  If all the workers are being
 522       // requested to be active but some are already idle, reduce
 523       // the number of active_workers to be consistent with the
 524       // number of idle_workers.  The idle_workers are stuck in
 525       // idle tasks and will no longer be release (since a new GC
 526       // is starting).  Try later to release enough idle_workers
 527       // to allow the desired number of active_workers.
 528       more_inactive_workers =
 529         created_workers() - active_workers() - idle_workers();
 530       if (more_inactive_workers < 0) {
 531         int reduced_active_workers = active_workers() + more_inactive_workers;
 532         set_active_workers(reduced_active_workers);
 533         more_inactive_workers = 0;
 534       }
 535       log_trace(gc, task)("JT: %d  workers %d  active  %d  idle %d  more %d",
 536                           Threads::number_of_non_daemon_threads(),
 537                           created_workers(),
 538                           active_workers(),
 539                           idle_workers(),
 540                           more_inactive_workers);
 541     }
 542     GCTaskQueue* q = GCTaskQueue::create();
 543     for(uint i = 0; i < (uint) more_inactive_workers; i++) {
 544       q->enqueue(IdleGCTask::create_on_c_heap());
 545       increment_idle_workers();
 546     }
 547     assert(created_workers() == active_workers() + idle_workers(),
 548       "total workers should equal active + inactive");
 549     add_list(q);
 550     // GCTaskQueue* q was created in a ResourceArea so a
 551     // destroy() call is not needed.
 552   }




 512     int more_inactive_workers = 0;
 513     {
 514       // Stop any idle tasks from exiting their IdleGCTask's
 515       // and get the count for additional IdleGCTask's under
 516       // the GCTaskManager's monitor so that the "more_inactive_workers"
 517       // count is correct.
 518       MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
 519       _wait_helper.set_should_wait(true);
 520       // active_workers are a number being requested.  idle_workers
 521       // are the number currently idle.  If all the workers are being
 522       // requested to be active but some are already idle, reduce
 523       // the number of active_workers to be consistent with the
 524       // number of idle_workers.  The idle_workers are stuck in
 525       // idle tasks and will no longer be release (since a new GC
 526       // is starting).  Try later to release enough idle_workers
 527       // to allow the desired number of active_workers.
 528       more_inactive_workers =
 529         created_workers() - active_workers() - idle_workers();
 530       if (more_inactive_workers < 0) {
 531         int reduced_active_workers = active_workers() + more_inactive_workers;
 532         update_active_workers(reduced_active_workers);
 533         more_inactive_workers = 0;
 534       }
 535       log_trace(gc, task)("JT: %d  workers %d  active  %d  idle %d  more %d",
 536                           Threads::number_of_non_daemon_threads(),
 537                           created_workers(),
 538                           active_workers(),
 539                           idle_workers(),
 540                           more_inactive_workers);
 541     }
 542     GCTaskQueue* q = GCTaskQueue::create();
 543     for(uint i = 0; i < (uint) more_inactive_workers; i++) {
 544       q->enqueue(IdleGCTask::create_on_c_heap());
 545       increment_idle_workers();
 546     }
 547     assert(created_workers() == active_workers() + idle_workers(),
 548       "total workers should equal active + inactive");
 549     add_list(q);
 550     // GCTaskQueue* q was created in a ResourceArea so a
 551     // destroy() call is not needed.
 552   }


< prev index next >