8209346: Refactor SATBMarkQueue filter configuration
Moved reference to G1-specific option to G1CollectedHeap. Reviewed-by: shade, rkennke
This commit is contained in:
parent
bfb0a2ea3f
commit
8f31a55f91
@ -1691,6 +1691,7 @@ jint G1CollectedHeap::initialize() {
|
||||
SATB_Q_CBL_mon,
|
||||
SATB_Q_FL_lock,
|
||||
G1SATBProcessCompletedThreshold,
|
||||
G1SATBBufferEnqueueingThresholdPercent,
|
||||
Shared_SATB_Q_lock);
|
||||
|
||||
jint ecode = initialize_concurrent_refinement();
|
||||
|
@ -37,8 +37,12 @@ G1SATBMarkQueueSet::G1SATBMarkQueueSet() : _g1h(NULL) {}
|
||||
void G1SATBMarkQueueSet::initialize(G1CollectedHeap* g1h,
|
||||
Monitor* cbl_mon, Mutex* fl_lock,
|
||||
int process_completed_threshold,
|
||||
uint buffer_enqueue_threshold_percentage,
|
||||
Mutex* lock) {
|
||||
SATBMarkQueueSet::initialize(cbl_mon, fl_lock, process_completed_threshold, lock);
|
||||
SATBMarkQueueSet::initialize(cbl_mon, fl_lock,
|
||||
process_completed_threshold,
|
||||
buffer_enqueue_threshold_percentage,
|
||||
lock);
|
||||
_g1h = g1h;
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,7 @@ public:
|
||||
void initialize(G1CollectedHeap* g1h,
|
||||
Monitor* cbl_mon, Mutex* fl_lock,
|
||||
int process_completed_threshold,
|
||||
uint buffer_enqueue_threshold_percentage,
|
||||
Mutex* lock);
|
||||
|
||||
static void handle_zero_index_for_thread(JavaThread* t);
|
||||
|
@ -40,7 +40,8 @@ SATBMarkQueue::SATBMarkQueue(SATBMarkQueueSet* qset, bool permanent) :
|
||||
// them with their active field set to false. If a thread is
|
||||
// created during a cycle and its SATB queue needs to be activated
|
||||
// before the thread starts running, we'll need to set its active
|
||||
// field to true. This is done in G1SBarrierSet::on_thread_attach().
|
||||
// field to true. This must be done in the collector-specific
|
||||
// BarrierSet::on_thread_attach() implementation.
|
||||
PtrQueue(qset, permanent, false /* active */)
|
||||
{ }
|
||||
|
||||
@ -59,8 +60,6 @@ bool SATBMarkQueue::should_enqueue_buffer() {
|
||||
assert(_lock == NULL || _lock->owned_by_self(),
|
||||
"we should have taken the lock before calling this");
|
||||
|
||||
// If G1SATBBufferEnqueueingThresholdPercent == 0 we could skip filtering.
|
||||
|
||||
// This method should only be called if there is a non-NULL buffer
|
||||
// that is full.
|
||||
assert(index() == 0, "pre-condition");
|
||||
@ -68,10 +67,15 @@ bool SATBMarkQueue::should_enqueue_buffer() {
|
||||
|
||||
filter();
|
||||
|
||||
size_t cap = capacity();
|
||||
size_t percent_used = ((cap - index()) * 100) / cap;
|
||||
bool should_enqueue = percent_used > G1SATBBufferEnqueueingThresholdPercent;
|
||||
return should_enqueue;
|
||||
SATBMarkQueueSet* satb_qset = static_cast<SATBMarkQueueSet*>(qset());
|
||||
size_t threshold = satb_qset->buffer_enqueue_threshold();
|
||||
// Ensure we'll enqueue completely full buffers.
|
||||
assert(threshold > 0, "enqueue threshold = 0");
|
||||
// Ensure we won't enqueue empty buffers.
|
||||
assert(threshold <= capacity(),
|
||||
"enqueue threshold " SIZE_FORMAT " exceeds capacity " SIZE_FORMAT,
|
||||
threshold, capacity());
|
||||
return index() < threshold;
|
||||
}
|
||||
|
||||
void SATBMarkQueue::apply_closure_and_empty(SATBBufferClosure* cl) {
|
||||
@ -103,14 +107,21 @@ void SATBMarkQueue::print(const char* name) {
|
||||
|
||||
SATBMarkQueueSet::SATBMarkQueueSet() :
|
||||
PtrQueueSet(),
|
||||
_shared_satb_queue(this, true /* permanent */)
|
||||
_shared_satb_queue(this, true /* permanent */),
|
||||
_buffer_enqueue_threshold(0)
|
||||
{}
|
||||
|
||||
void SATBMarkQueueSet::initialize(Monitor* cbl_mon, Mutex* fl_lock,
|
||||
int process_completed_threshold,
|
||||
uint buffer_enqueue_threshold_percentage,
|
||||
Mutex* lock) {
|
||||
PtrQueueSet::initialize(cbl_mon, fl_lock, process_completed_threshold, -1);
|
||||
_shared_satb_queue.set_lock(lock);
|
||||
assert(buffer_size() != 0, "buffer size not initialized");
|
||||
// Minimum threshold of 1 ensures enqueuing of completely full buffers.
|
||||
size_t size = buffer_size();
|
||||
size_t enqueue_qty = (size * buffer_enqueue_threshold_percentage) / 100;
|
||||
_buffer_enqueue_threshold = MAX2(size - enqueue_qty, (size_t)1);
|
||||
}
|
||||
|
||||
#ifdef ASSERT
|
||||
|
@ -92,6 +92,7 @@ public:
|
||||
|
||||
class SATBMarkQueueSet: public PtrQueueSet {
|
||||
SATBMarkQueue _shared_satb_queue;
|
||||
size_t _buffer_enqueue_threshold;
|
||||
|
||||
#ifdef ASSERT
|
||||
void dump_active_states(bool expected_active);
|
||||
@ -109,6 +110,7 @@ protected:
|
||||
|
||||
void initialize(Monitor* cbl_mon, Mutex* fl_lock,
|
||||
int process_completed_threshold,
|
||||
uint buffer_enqueue_threshold_percentage,
|
||||
Mutex* lock);
|
||||
|
||||
public:
|
||||
@ -120,6 +122,7 @@ public:
|
||||
// set itself, has an active value same as expected_active.
|
||||
void set_active_all_threads(bool active, bool expected_active);
|
||||
|
||||
size_t buffer_enqueue_threshold() const { return _buffer_enqueue_threshold; }
|
||||
virtual void filter(SATBMarkQueue* queue) = 0;
|
||||
|
||||
// Filter all the currently-active SATB buffers.
|
||||
|
Loading…
x
Reference in New Issue
Block a user