< prev index next >
src/hotspot/share/gc/g1/g1ConcurrentRefineThread.cpp
Print this page
rev 47675 : [mq]: 8149127-rename-concurrentrefine-a
rev 47676 : imported patch 8149127-rename-concurrentrefine-b
rev 47677 : [mq]: 8149127-rename-concurrentrefine-b-stefanj-review
rev 47680 : [mq]: 8190426-lazy-init-refinement-threads
*** 23,58 ****
*/
#include "precompiled.hpp"
#include "gc/g1/g1ConcurrentRefine.hpp"
#include "gc/g1/g1ConcurrentRefineThread.hpp"
- #include "gc/g1/g1CollectedHeap.inline.hpp"
- #include "gc/g1/g1RemSet.hpp"
#include "gc/shared/suspendibleThreadSet.hpp"
#include "logging/log.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/mutexLocker.hpp"
! G1ConcurrentRefineThread::G1ConcurrentRefineThread(G1ConcurrentRefine* cr,
! G1ConcurrentRefineThread *next,
! uint worker_id_offset,
! uint worker_id,
! size_t activate,
! size_t deactivate) :
ConcurrentGCThread(),
- _worker_id_offset(worker_id_offset),
_worker_id(worker_id),
_active(false),
- _next(next),
_monitor(NULL),
_cr(cr),
! _vtime_accum(0.0),
! _activation_threshold(activate),
! _deactivation_threshold(deactivate)
{
-
// Each thread has its own monitor. The i-th thread is responsible for signaling
// to thread i+1 if the number of buffers in the queue exceeds a threshold for this
// thread. Monitors are also used to wake up the threads during termination.
// The 0th (primary) worker is notified by mutator threads and has a special monitor.
if (!is_primary()) {
--- 23,46 ----
*/
#include "precompiled.hpp"
#include "gc/g1/g1ConcurrentRefine.hpp"
#include "gc/g1/g1ConcurrentRefineThread.hpp"
#include "gc/shared/suspendibleThreadSet.hpp"
#include "logging/log.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/mutexLocker.hpp"
! G1ConcurrentRefineThread::G1ConcurrentRefineThread(G1ConcurrentRefine* cr, uint worker_id) :
ConcurrentGCThread(),
_worker_id(worker_id),
_active(false),
_monitor(NULL),
_cr(cr),
! _vtime_accum(0.0)
{
// Each thread has its own monitor. The i-th thread is responsible for signaling
// to thread i+1 if the number of buffers in the queue exceeds a threshold for this
// thread. Monitors are also used to wake up the threads during termination.
// The 0th (primary) worker is notified by mutator threads and has a special monitor.
if (!is_primary()) {
*** 65,81 ****
// set name
set_name("G1 Refine#%d", worker_id);
create_and_start();
}
- void G1ConcurrentRefineThread::update_thresholds(size_t activate,
- size_t deactivate) {
- assert(deactivate < activate, "precondition");
- _activation_threshold = activate;
- _deactivation_threshold = deactivate;
- }
-
void G1ConcurrentRefineThread::wait_for_completed_buffers() {
MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag);
while (!should_terminate() && !is_active()) {
_monitor->wait(Mutex::_no_safepoint_check_flag);
}
--- 53,62 ----
*** 116,165 ****
if (should_terminate()) {
break;
}
size_t buffers_processed = 0;
! DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
! log_debug(gc, refine)("Activated %d, on threshold: " SIZE_FORMAT ", current: " SIZE_FORMAT,
! _worker_id, _activation_threshold, dcqs.completed_buffers_num());
{
SuspendibleThreadSetJoiner sts_join;
while (!should_terminate()) {
if (sts_join.should_yield()) {
sts_join.yield();
continue; // Re-check for termination after yield delay.
}
! size_t curr_buffer_num = dcqs.completed_buffers_num();
! // If the number of the buffers falls down into the yellow zone,
! // that means that the transition period after the evacuation pause has ended.
! if (dcqs.completed_queue_padding() > 0 && curr_buffer_num <= cr()->yellow_zone()) {
! dcqs.set_completed_queue_padding(0);
! }
!
! // Check if we need to activate the next thread.
! if ((_next != NULL) &&
! !_next->is_active() &&
! (curr_buffer_num > _next->_activation_threshold)) {
! _next->activate();
! }
!
! // Process the next buffer, if there are enough left.
! if (!dcqs.refine_completed_buffer_concurrently(_worker_id + _worker_id_offset, _deactivation_threshold)) {
! break; // Deactivate, number of buffers fell below threshold.
}
++buffers_processed;
}
}
deactivate();
! log_debug(gc, refine)("Deactivated %d, off threshold: " SIZE_FORMAT
", current: " SIZE_FORMAT ", processed: " SIZE_FORMAT,
! _worker_id, _deactivation_threshold,
! dcqs.completed_buffers_num(),
buffers_processed);
if (os::supports_vtime()) {
_vtime_accum = (os::elapsedVTime() - _vtime_start);
} else {
--- 97,131 ----
if (should_terminate()) {
break;
}
size_t buffers_processed = 0;
! log_debug(gc, refine)("Activated worker %d, on threshold: " SIZE_FORMAT ", current: " SIZE_FORMAT,
! _worker_id, _cr->activation_threshold(_worker_id),
! JavaThread::dirty_card_queue_set().completed_buffers_num());
{
SuspendibleThreadSetJoiner sts_join;
while (!should_terminate()) {
if (sts_join.should_yield()) {
sts_join.yield();
continue; // Re-check for termination after yield delay.
}
! if (!_cr->do_refinement_step(_worker_id)) {
! break;
}
++buffers_processed;
}
}
deactivate();
! log_debug(gc, refine)("Deactivated worker %d, off threshold: " SIZE_FORMAT
", current: " SIZE_FORMAT ", processed: " SIZE_FORMAT,
! _worker_id, _cr->deactivation_threshold(_worker_id),
! JavaThread::dirty_card_queue_set().completed_buffers_num(),
buffers_processed);
if (os::supports_vtime()) {
_vtime_accum = (os::elapsedVTime() - _vtime_start);
} else {
< prev index next >