Skip to content

Commit c7be7e7

Browse files
author
duke
committedSep 1, 2020
Automatic merge of jdk:master into master
2 parents cdb63ce + 2c4fbbc commit c7be7e7

7 files changed

+61
-56
lines changed
 

‎src/hotspot/share/gc/g1/g1CollectedHeap.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
#include "gc/g1/g1ThreadLocalData.hpp"
6464
#include "gc/g1/g1Trace.hpp"
6565
#include "gc/g1/g1YCTypes.hpp"
66-
#include "gc/g1/g1YoungRemSetSamplingThread.hpp"
66+
#include "gc/g1/g1ServiceThread.hpp"
6767
#include "gc/g1/g1VMOperations.hpp"
6868
#include "gc/g1/heapRegion.inline.hpp"
6969
#include "gc/g1/heapRegionRemSet.hpp"
@@ -1419,7 +1419,7 @@ class HumongousRegionSetChecker : public HeapRegionSetChecker {
14191419

14201420
G1CollectedHeap::G1CollectedHeap() :
14211421
CollectedHeap(),
1422-
_young_gen_sampling_thread(NULL),
1422+
_service_thread(NULL),
14231423
_workers(NULL),
14241424
_card_table(NULL),
14251425
_collection_pause_end(Ticks::now()),
@@ -1556,10 +1556,10 @@ jint G1CollectedHeap::initialize_concurrent_refinement() {
15561556
return ecode;
15571557
}
15581558

1559-
jint G1CollectedHeap::initialize_young_gen_sampling_thread() {
1560-
_young_gen_sampling_thread = new G1YoungRemSetSamplingThread();
1561-
if (_young_gen_sampling_thread->osthread() == NULL) {
1562-
vm_shutdown_during_initialization("Could not create G1YoungRemSetSamplingThread");
1559+
jint G1CollectedHeap::initialize_service_thread() {
1560+
_service_thread = new G1ServiceThread();
1561+
if (_service_thread->osthread() == NULL) {
1562+
vm_shutdown_during_initialization("Could not create G1ServiceThread");
15631563
return JNI_ENOMEM;
15641564
}
15651565
return JNI_OK;
@@ -1733,7 +1733,7 @@ jint G1CollectedHeap::initialize() {
17331733
return ecode;
17341734
}
17351735

1736-
ecode = initialize_young_gen_sampling_thread();
1736+
ecode = initialize_service_thread();
17371737
if (ecode != JNI_OK) {
17381738
return ecode;
17391739
}
@@ -1779,7 +1779,7 @@ void G1CollectedHeap::stop() {
17791779
// do not continue to execute and access resources (e.g. logging)
17801780
// that are destroyed during shutdown.
17811781
_cr->stop();
1782-
_young_gen_sampling_thread->stop();
1782+
_service_thread->stop();
17831783
_cm_thread->stop();
17841784
if (G1StringDedup::is_enabled()) {
17851785
G1StringDedup::stop();
@@ -2534,7 +2534,7 @@ void G1CollectedHeap::gc_threads_do(ThreadClosure* tc) const {
25342534
tc->do_thread(_cm_thread);
25352535
_cm->threads_do(tc);
25362536
_cr->threads_do(tc);
2537-
tc->do_thread(_young_gen_sampling_thread);
2537+
tc->do_thread(_service_thread);
25382538
if (G1StringDedup::is_enabled()) {
25392539
G1StringDedup::threads_do(tc);
25402540
}

‎src/hotspot/share/gc/g1/g1CollectedHeap.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class G1CollectionSet;
8080
class G1Policy;
8181
class G1HotCardCache;
8282
class G1RemSet;
83-
class G1YoungRemSetSamplingThread;
83+
class G1ServiceThread;
8484
class G1ConcurrentMark;
8585
class G1ConcurrentMarkThread;
8686
class G1ConcurrentRefine;
@@ -154,7 +154,7 @@ class G1CollectedHeap : public CollectedHeap {
154154
friend class G1CheckRegionAttrTableClosure;
155155

156156
private:
157-
G1YoungRemSetSamplingThread* _young_gen_sampling_thread;
157+
G1ServiceThread* _service_thread;
158158

159159
WorkGang* _workers;
160160
G1CardTable* _card_table;
@@ -547,7 +547,7 @@ class G1CollectedHeap : public CollectedHeap {
547547
void verify_numa_regions(const char* desc);
548548

549549
public:
550-
G1YoungRemSetSamplingThread* sampling_thread() const { return _young_gen_sampling_thread; }
550+
G1ServiceThread* service_thread() const { return _service_thread; }
551551

552552
WorkGang* workers() const { return _workers; }
553553

@@ -968,7 +968,7 @@ class G1CollectedHeap : public CollectedHeap {
968968

969969
private:
970970
jint initialize_concurrent_refinement();
971-
jint initialize_young_gen_sampling_thread();
971+
jint initialize_service_thread();
972972
public:
973973
// Initialize the G1CollectedHeap to have the initial and
974974
// maximum sizes and remembered and barrier sets

‎src/hotspot/share/gc/g1/g1RemSetSummary.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include "gc/g1/g1DirtyCardQueue.hpp"
3131
#include "gc/g1/g1RemSet.hpp"
3232
#include "gc/g1/g1RemSetSummary.hpp"
33-
#include "gc/g1/g1YoungRemSetSamplingThread.hpp"
33+
#include "gc/g1/g1ServiceThread.hpp"
3434
#include "gc/g1/heapRegion.hpp"
3535
#include "gc/g1/heapRegionRemSet.hpp"
3636
#include "memory/allocation.inline.hpp"
@@ -53,7 +53,7 @@ void G1RemSetSummary::update() {
5353
g1h->concurrent_refine()->threads_do(&collector);
5454
_num_coarsenings = HeapRegionRemSet::n_coarsenings();
5555

56-
set_sampling_thread_vtime(g1h->sampling_thread()->vtime_accum());
56+
set_service_thread_vtime(g1h->service_thread()->vtime_accum());
5757
}
5858

5959
void G1RemSetSummary::set_rs_thread_vtime(uint thread, double value) {
@@ -72,7 +72,7 @@ G1RemSetSummary::G1RemSetSummary(bool should_update) :
7272
_num_coarsenings(0),
7373
_num_vtimes(G1ConcurrentRefine::max_num_threads()),
7474
_rs_threads_vtimes(NEW_C_HEAP_ARRAY(double, _num_vtimes, mtGC)),
75-
_sampling_thread_vtime(0.0f) {
75+
_service_thread_vtime(0.0f) {
7676

7777
memset(_rs_threads_vtimes, 0, sizeof(double) * _num_vtimes);
7878

@@ -93,7 +93,7 @@ void G1RemSetSummary::set(G1RemSetSummary* other) {
9393

9494
memcpy(_rs_threads_vtimes, other->_rs_threads_vtimes, sizeof(double) * _num_vtimes);
9595

96-
set_sampling_thread_vtime(other->sampling_thread_vtime());
96+
set_service_thread_vtime(other->service_thread_vtime());
9797
}
9898

9999
void G1RemSetSummary::subtract_from(G1RemSetSummary* other) {
@@ -106,7 +106,7 @@ void G1RemSetSummary::subtract_from(G1RemSetSummary* other) {
106106
set_rs_thread_vtime(i, other->rs_thread_vtime(i) - rs_thread_vtime(i));
107107
}
108108

109-
_sampling_thread_vtime = other->sampling_thread_vtime() - _sampling_thread_vtime;
109+
_service_thread_vtime = other->service_thread_vtime() - _service_thread_vtime;
110110
}
111111

112112
class RegionTypeCounter {
@@ -327,8 +327,8 @@ void G1RemSetSummary::print_on(outputStream* out) {
327327
out->print(" %5.2f", rs_thread_vtime(i));
328328
}
329329
out->cr();
330-
out->print_cr(" Concurrent sampling threads times (s)");
331-
out->print_cr(" %5.2f", sampling_thread_vtime());
330+
out->print_cr(" Service thread time (s)");
331+
out->print_cr(" %5.2f", service_thread_vtime());
332332

333333
HRRSStatsIter blk;
334334
G1CollectedHeap::heap()->heap_region_iterate(&blk);

‎src/hotspot/share/gc/g1/g1RemSetSummary.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ class G1RemSetSummary {
3838
size_t _num_vtimes;
3939
double* _rs_threads_vtimes;
4040

41-
double _sampling_thread_vtime;
41+
double _service_thread_vtime;
4242

4343
void set_rs_thread_vtime(uint thread, double value);
44-
void set_sampling_thread_vtime(double value) {
45-
_sampling_thread_vtime = value;
44+
void set_service_thread_vtime(double value) {
45+
_service_thread_vtime = value;
4646
}
4747

4848
// update this summary with current data from various places
@@ -62,8 +62,8 @@ class G1RemSetSummary {
6262

6363
double rs_thread_vtime(uint thread) const;
6464

65-
double sampling_thread_vtime() const {
66-
return _sampling_thread_vtime;
65+
double service_thread_vtime() const {
66+
return _service_thread_vtime;
6767
}
6868

6969
size_t num_coarsenings() const {

‎src/hotspot/share/gc/g1/g1YoungRemSetSamplingThread.cpp ‎src/hotspot/share/gc/g1/g1ServiceThread.cpp

+12-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -28,34 +28,35 @@
2828
#include "gc/g1/g1ConcurrentMark.inline.hpp"
2929
#include "gc/g1/g1ConcurrentMarkThread.inline.hpp"
3030
#include "gc/g1/g1Policy.hpp"
31-
#include "gc/g1/g1YoungRemSetSamplingThread.hpp"
31+
#include "gc/g1/g1ServiceThread.hpp"
3232
#include "gc/g1/heapRegion.inline.hpp"
3333
#include "gc/g1/heapRegionRemSet.hpp"
3434
#include "gc/shared/suspendibleThreadSet.hpp"
3535
#include "memory/universe.hpp"
3636
#include "runtime/mutexLocker.hpp"
37+
#include "runtime/os.hpp"
3738

38-
G1YoungRemSetSamplingThread::G1YoungRemSetSamplingThread() :
39+
G1ServiceThread::G1ServiceThread() :
3940
ConcurrentGCThread(),
4041
_monitor(Mutex::nonleaf,
41-
"G1YoungRemSetSamplingThread monitor",
42+
"G1ServiceThread monitor",
4243
true,
4344
Monitor::_safepoint_check_never),
4445
_last_periodic_gc_attempt_s(os::elapsedTime()),
4546
_vtime_accum(0) {
46-
set_name("G1 Young RemSet Sampling");
47+
set_name("G1 Service");
4748
create_and_start();
4849
}
4950

50-
void G1YoungRemSetSamplingThread::sleep_before_next_cycle() {
51+
void G1ServiceThread::sleep_before_next_cycle() {
5152
MonitorLocker ml(&_monitor, Mutex::_no_safepoint_check_flag);
5253
if (!should_terminate()) {
5354
uintx waitms = G1ConcRefinementServiceIntervalMillis;
5455
ml.wait(waitms);
5556
}
5657
}
5758

58-
bool G1YoungRemSetSamplingThread::should_start_periodic_gc() {
59+
bool G1ServiceThread::should_start_periodic_gc() {
5960
G1CollectedHeap* g1h = G1CollectedHeap::heap();
6061
// If we are currently in a concurrent mark we are going to uncommit memory soon.
6162
if (g1h->concurrent_mark()->cm_thread()->during_cycle()) {
@@ -83,7 +84,7 @@ bool G1YoungRemSetSamplingThread::should_start_periodic_gc() {
8384
return true;
8485
}
8586

86-
void G1YoungRemSetSamplingThread::check_for_periodic_gc(){
87+
void G1ServiceThread::check_for_periodic_gc(){
8788
// If disabled, just return.
8889
if (G1PeriodicGCInterval == 0) {
8990
return;
@@ -99,7 +100,7 @@ void G1YoungRemSetSamplingThread::check_for_periodic_gc(){
99100
}
100101
}
101102

102-
void G1YoungRemSetSamplingThread::run_service() {
103+
void G1ServiceThread::run_service() {
103104
double vtime_start = os::elapsedVTime();
104105

105106
while (!should_terminate()) {
@@ -117,7 +118,7 @@ void G1YoungRemSetSamplingThread::run_service() {
117118
}
118119
}
119120

120-
void G1YoungRemSetSamplingThread::stop_service() {
121+
void G1ServiceThread::stop_service() {
121122
MutexLocker x(&_monitor, Mutex::_no_safepoint_check_flag);
122123
_monitor.notify();
123124
}
@@ -154,7 +155,7 @@ class G1YoungRemSetSamplingClosure : public HeapRegionClosure {
154155
size_t sampled_rs_length() const { return _sampled_rs_length; }
155156
};
156157

157-
void G1YoungRemSetSamplingThread::sample_young_list_rs_length() {
158+
void G1ServiceThread::sample_young_list_rs_length() {
158159
SuspendibleThreadSetJoiner sts;
159160
G1CollectedHeap* g1h = G1CollectedHeap::heap();
160161
G1Policy* policy = g1h->policy();

‎src/hotspot/share/gc/g1/g1YoungRemSetSamplingThread.hpp ‎src/hotspot/share/gc/g1/g1ServiceThread.hpp

+22-18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -22,31 +22,35 @@
2222
*
2323
*/
2424

25-
#ifndef SHARE_GC_G1_G1YOUNGREMSETSAMPLINGTHREAD_HPP
26-
#define SHARE_GC_G1_G1YOUNGREMSETSAMPLINGTHREAD_HPP
25+
#ifndef SHARE_GC_G1_G1SERVICETHREAD_HPP
26+
#define SHARE_GC_G1_G1SERVICETHREAD_HPP
2727

2828
#include "gc/shared/concurrentGCThread.hpp"
29+
#include "runtime/mutex.hpp"
2930

30-
// The G1YoungRemSetSamplingThread is used to re-assess the validity of
31-
// the prediction for the remembered set lengths of the young generation.
32-
//
33-
// At the end of the GC G1 determines the length of the young gen based on
34-
// how much time the next GC can take, and when the next GC may occur
35-
// according to the MMU.
36-
//
37-
// The assumption is that a significant part of the GC is spent on scanning
38-
// the remembered sets (and many other components), so this thread constantly
39-
// reevaluates the prediction for the remembered set scanning costs, and potentially
40-
// G1Policy resizes the young gen. This may do a premature GC or even
41-
// increase the young gen size to keep pause time length goal.
42-
class G1YoungRemSetSamplingThread: public ConcurrentGCThread {
31+
// The G1ServiceThread is used to periodically do a number of different tasks:
32+
// - re-assess the validity of the prediction for the
33+
// remembered set lengths of the young generation.
34+
// - check if a periodic GC should be scheduled.
35+
class G1ServiceThread: public ConcurrentGCThread {
4336
private:
4437
Monitor _monitor;
4538

4639
double _last_periodic_gc_attempt_s;
4740

4841
double _vtime_accum; // Accumulated virtual time.
4942

43+
// Sample the current length of remembered sets for young.
44+
//
45+
// At the end of the GC G1 determines the length of the young gen based on
46+
// how much time the next GC can take, and when the next GC may occur
47+
// according to the MMU.
48+
//
49+
// The assumption is that a significant part of the GC is spent on scanning
50+
// the remembered sets (and many other components), so this thread constantly
51+
// reevaluates the prediction for the remembered set scanning costs, and potentially
52+
// G1Policy resizes the young gen. This may do a premature GC or even
53+
// increase the young gen size to keep pause time length goal.
5054
void sample_young_list_rs_length();
5155

5256
void run_service();
@@ -59,8 +63,8 @@ class G1YoungRemSetSamplingThread: public ConcurrentGCThread {
5963
bool should_start_periodic_gc();
6064

6165
public:
62-
G1YoungRemSetSamplingThread();
66+
G1ServiceThread();
6367
double vtime_accum() { return _vtime_accum; }
6468
};
6569

66-
#endif // SHARE_GC_G1_G1YOUNGREMSETSAMPLINGTHREAD_HPP
70+
#endif // SHARE_GC_G1_G1SERVICETHREAD_HPP

‎src/hotspot/share/gc/g1/g1_globals.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@
131131
range(0, max_intx) \
132132
\
133133
product(uintx, G1ConcRefinementServiceIntervalMillis, 300, \
134-
"The last concurrent refinement thread wakes up every " \
135-
"specified number of milliseconds to do miscellaneous work.") \
134+
"The G1 service thread wakes up every specified number of " \
135+
"milliseconds to do miscellaneous work.") \
136136
range(0, max_jint) \
137137
\
138138
product(size_t, G1ConcRefinementThresholdStep, 2, \

0 commit comments

Comments
 (0)
Please sign in to comment.