Mercurial > hg > graal-jvmci-8
annotate src/share/vm/gc_implementation/g1/g1MMUTracker.hpp @ 2149:7e37af9d69ef
7011379: G1: overly long concurrent marking cycles
Summary: This changeset introduces filtering of SATB buffers at the point when they are about to be enqueued. If this filtering clears enough entries on each buffer, the buffer can then be re-used and not enqueued. This cuts down the number of SATB buffers that need to be processed by the concurrent marking threads.
Reviewed-by: johnc, ysr
author | tonyp |
---|---|
date | Wed, 19 Jan 2011 09:35:17 -0500 |
parents | f95d63e2154a |
children | d2a62e0f25eb |
rev | line source |
---|---|
342 | 1 /* |
1972 | 2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. |
342 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1282
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1282
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1282
diff
changeset
|
21 * questions. |
342 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1MMUTRACKER_HPP |
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1MMUTRACKER_HPP | |
27 | |
28 #include "memory/allocation.hpp" | |
29 #include "utilities/debug.hpp" | |
30 | |
342 | 31 // Keeps track of the GC work and decides when it is OK to do GC work |
32 // and for how long so that the MMU invariants are maintained. | |
33 | |
34 /***** ALL TIMES ARE IN SECS!!!!!!! *****/ | |
35 | |
36 // this is the "interface" | |
549
fe3d7c11b4b7
6700941: G1: allocation spec missing for some G1 classes
apetrusenko
parents:
342
diff
changeset
|
37 class G1MMUTracker: public CHeapObj { |
342 | 38 protected: |
39 double _time_slice; | |
40 double _max_gc_time; // this is per time slice | |
41 | |
42 public: | |
43 G1MMUTracker(double time_slice, double max_gc_time); | |
44 | |
45 virtual void add_pause(double start, double end, bool gc_thread) = 0; | |
46 virtual double longest_pause(double current_time) = 0; | |
47 virtual double when_sec(double current_time, double pause_time) = 0; | |
48 | |
49 double max_gc_time() { | |
936 | 50 return _max_gc_time; |
342 | 51 } |
52 | |
53 inline bool now_max_gc(double current_time) { | |
54 return when_sec(current_time, max_gc_time()) < 0.00001; | |
55 } | |
56 | |
57 inline double when_max_gc_sec(double current_time) { | |
58 return when_sec(current_time, max_gc_time()); | |
59 } | |
60 | |
61 inline jlong when_max_gc_ms(double current_time) { | |
62 double when = when_max_gc_sec(current_time); | |
63 return (jlong) (when * 1000.0); | |
64 } | |
65 | |
66 inline jlong when_ms(double current_time, double pause_time) { | |
67 double when = when_sec(current_time, pause_time); | |
68 return (jlong) (when * 1000.0); | |
69 } | |
70 }; | |
71 | |
549
fe3d7c11b4b7
6700941: G1: allocation spec missing for some G1 classes
apetrusenko
parents:
342
diff
changeset
|
72 class G1MMUTrackerQueueElem VALUE_OBJ_CLASS_SPEC { |
342 | 73 private: |
74 double _start_time; | |
75 double _end_time; | |
76 | |
77 public: | |
78 inline double start_time() { return _start_time; } | |
79 inline double end_time() { return _end_time; } | |
80 inline double duration() { return _end_time - _start_time; } | |
81 | |
82 G1MMUTrackerQueueElem() { | |
83 _start_time = 0.0; | |
84 _end_time = 0.0; | |
85 } | |
86 | |
87 G1MMUTrackerQueueElem(double start_time, double end_time) { | |
88 _start_time = start_time; | |
89 _end_time = end_time; | |
90 } | |
91 }; | |
92 | |
93 // this is an implementation of the MMUTracker using a (fixed-size) queue | |
94 // that keeps track of all the recent pause times | |
95 class G1MMUTrackerQueue: public G1MMUTracker { | |
96 private: | |
97 enum PrivateConstants { | |
98 QueueLength = 64 | |
99 }; | |
100 | |
101 // The array keeps track of all the pauses that fall within a time | |
102 // slice (the last time slice during which pauses took place). | |
103 // The data structure implemented is a circular queue. | |
104 // Head "points" to the most recent addition, tail to the oldest one. | |
105 // The array is of fixed size and I don't think we'll need more than | |
106 // two or three entries with the current behaviour of G1 pauses. | |
107 // If the array is full, an easy fix is to look for the pauses with | |
1088
3fc996d4edd2
6902303: G1: ScavengeALot should cause an incremental, rather than a full, collection
ysr
parents:
936
diff
changeset
|
108 // the shortest gap between them and consolidate them. |
3fc996d4edd2
6902303: G1: ScavengeALot should cause an incremental, rather than a full, collection
ysr
parents:
936
diff
changeset
|
109 // For now, we have taken the expedient alternative of forgetting |
1282 | 110 // the oldest entry in the event that +G1UseFixedWindowMMUTracker, thus |
1088
3fc996d4edd2
6902303: G1: ScavengeALot should cause an incremental, rather than a full, collection
ysr
parents:
936
diff
changeset
|
111 // potentially violating MMU specs for some time thereafter. |
342 | 112 |
113 G1MMUTrackerQueueElem _array[QueueLength]; | |
114 int _head_index; | |
115 int _tail_index; | |
116 int _no_entries; | |
117 | |
118 inline int trim_index(int index) { | |
119 return (index + QueueLength) % QueueLength; | |
120 } | |
121 | |
122 void remove_expired_entries(double current_time); | |
123 double calculate_gc_time(double current_time); | |
124 | |
125 double longest_pause_internal(double current_time); | |
126 double when_internal(double current_time, double pause_time); | |
127 | |
128 public: | |
129 G1MMUTrackerQueue(double time_slice, double max_gc_time); | |
130 | |
131 virtual void add_pause(double start, double end, bool gc_thread); | |
132 | |
133 virtual double longest_pause(double current_time); | |
134 virtual double when_sec(double current_time, double pause_time); | |
135 }; | |
1972 | 136 |
137 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1MMUTRACKER_HPP |