Skip to content
Permalink
Browse files

8237261: Concurrent refinement activation threshold not updated for c…

…ard counts

Fix special-case threshold calculation for primary refinement thread

Reviewed-by: tschatzl, sjohanss
  • Loading branch information
Kim Barrett
Kim Barrett committed Jan 20, 2020
1 parent b936939 commit f779e4959043e421ce06a6787fed35e9f59a2861
Showing with 10 additions and 9 deletions.
  1. +10 −9 src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -190,6 +190,10 @@ STATIC_ASSERT(max_yellow_zone <= max_red_zone);
// For logging zone values, ensuring consistency of level and tags.
#define LOG_ZONES(...) log_debug( CTRL_TAGS )(__VA_ARGS__)

static size_t buffers_to_cards(size_t value) {
return value * G1UpdateBufferSize;
}

// Package for pair of refinement thread activation and deactivation
// thresholds. The activation and deactivation levels are resp. the first
// and second values of the pair.
@@ -207,8 +211,9 @@ static Thresholds calc_thresholds(size_t green_zone,
// available buffers near green_zone value. When yellow_size is
// large we don't want to allow a full step to accumulate before
// doing any processing, as that might lead to significantly more
// than green_zone buffers to be processed during scanning.
step = MIN2(step, ParallelGCThreads / 2.0);
// than green_zone buffers to be processed during pause. So limit
// to an extra half buffer per pause-time processing thread.
step = MIN2(step, buffers_to_cards(ParallelGCThreads) / 2.0);
}
size_t activate_offset = static_cast<size_t>(ceil(step * (worker_id + 1)));
size_t deactivate_offset = static_cast<size_t>(floor(step * worker_id));
@@ -233,10 +238,6 @@ jint G1ConcurrentRefine::initialize() {
return _thread_control.initialize(this, max_num_threads());
}

static size_t buffers_to_cards(size_t value) {
return value * G1UpdateBufferSize;
}

static size_t calc_min_yellow_zone_size() {
size_t step = buffers_to_cards(G1ConcRefinementThresholdStep);
uint n_workers = G1ConcurrentRefine::max_num_threads();
@@ -443,8 +444,8 @@ uint G1ConcurrentRefine::worker_id_offset() {
return G1DirtyCardQueueSet::num_par_ids();
}

void G1ConcurrentRefine::maybe_activate_more_threads(uint worker_id, size_t num_cur_buffers) {
if (num_cur_buffers > activation_threshold(worker_id + 1)) {
void G1ConcurrentRefine::maybe_activate_more_threads(uint worker_id, size_t num_cur_cards) {
if (num_cur_cards > activation_threshold(worker_id + 1)) {
_thread_control.maybe_activate_next(worker_id);
}
}

0 comments on commit f779e49

Please sign in to comment.
You can’t perform that action at this time.