1 /* 2 * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. 3 * Copyright (c) 2016, 2021, Red Hat, Inc. All rights reserved. 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 * 6 * This code is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 only, as 8 * published by the Free Software Foundation. 9 * 10 * This code is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * version 2 for more details (a copy is included in the LICENSE file that 14 * accompanied this code). 15 * 16 * You should have received a copy of the GNU General Public License version 17 * 2 along with this work; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 * 24 */ 25 26 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP 27 #define SHARE_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP 28 29 #define GC_SHENANDOAH_FLAGS(develop, \ 30 develop_pd, \ 31 product, \ 32 product_pd, \ 33 range, \ 34 constraint) \ 35 \ 36 product(size_t, ShenandoahRegionSize, 0, EXPERIMENTAL, \ 37 "Static heap region size. Set zero to enable automatic sizing.") \ 38 \ 39 product(size_t, ShenandoahTargetNumRegions, 2048, EXPERIMENTAL, \ 40 "With automatic region sizing, this is the approximate number " \ 41 "of regions that would be used, within min/max region size " \ 42 "limits.") \ 43 \ 44 product(size_t, ShenandoahMinRegionSize, 256 * K, EXPERIMENTAL, \ 45 "With automatic region sizing, the regions would be at least " \ 46 "this large.") \ 47 \ 48 product(size_t, ShenandoahMaxRegionSize, 32 * M, EXPERIMENTAL, \ 49 "With automatic region sizing, the regions would be at most " \ 50 "this large.") \ 51 \ 52 product(ccstr, ShenandoahGCMode, "satb", \ 53 "GC mode to use. Among other things, this defines which " \ 54 "barriers are in in use. Possible values are:" \ 55 " satb - snapshot-at-the-beginning concurrent GC (three pass mark-evac-update);" \ 56 " iu - incremental-update concurrent GC (three pass mark-evac-update);" \ 57 " passive - stop the world GC only (either degenerated or full)") \ 58 \ 59 product(ccstr, ShenandoahGCHeuristics, "adaptive", \ 60 "GC heuristics to use. This fine-tunes the GC mode selected, " \ 61 "by choosing when to start the GC, how much to process on each " \ 62 "cycle, and what other features to automatically enable. " \ 63 "Possible values are:" \ 64 " adaptive - adapt to maintain the given amount of free heap " \ 65 "at all times, even during the GC cycle;" \ 66 " static - trigger GC when free heap falls below the threshold;" \ 67 " aggressive - run GC continuously, try to evacuate everything;" \ 68 " compact - run GC more frequently and with deeper targets to " \ 69 "free up more memory.") \ 70 \ 71 product(uintx, ShenandoahGarbageThreshold, 25, EXPERIMENTAL, \ 72 "How much garbage a region has to contain before it would be " \ 73 "taken for collection. This a guideline only, as GC heuristics " \ 74 "may select the region for collection even if it has little " \ 75 "garbage. This also affects how much internal fragmentation the " \ 76 "collector accepts. In percents of heap region size.") \ 77 range(0,100) \ 78 \ 79 product(uintx, ShenandoahInitFreeThreshold, 70, EXPERIMENTAL, \ 80 "How much heap should be free before some heuristics trigger the "\ 81 "initial (learning) cycles. Affects cycle frequency on startup " \ 82 "and after drastic state changes, e.g. after degenerated/full " \ 83 "GC cycles. In percents of (soft) max heap size.") \ 84 range(0,100) \ 85 \ 86 product(uintx, ShenandoahMinFreeThreshold, 10, EXPERIMENTAL, \ 87 "How much heap should be free before most heuristics trigger the "\ 88 "collection, even without other triggers. Provides the safety " \ 89 "margin for many heuristics. In percents of (soft) max heap size.")\ 90 range(0,100) \ 91 \ 92 product(uintx, ShenandoahAllocationThreshold, 0, EXPERIMENTAL, \ 93 "How many new allocations should happen since the last GC cycle " \ 94 "before some heuristics trigger the collection. In percents of " \ 95 "(soft) max heap size. Set to zero to effectively disable.") \ 96 range(0,100) \ 97 \ 98 product(uintx, ShenandoahAllocSpikeFactor, 5, EXPERIMENTAL, \ 99 "How much of heap should some heuristics reserve for absorbing " \ 100 "the allocation spikes. Larger value wastes more memory in " \ 101 "non-emergency cases, but provides more safety in emergency " \ 102 "cases. In percents of (soft) max heap size.") \ 103 range(0,100) \ 104 \ 105 product(uintx, ShenandoahLearningSteps, 5, EXPERIMENTAL, \ 106 "The number of cycles some heuristics take to collect in order " \ 107 "to learn application and GC performance.") \ 108 range(0,100) \ 109 \ 110 product(uintx, ShenandoahImmediateThreshold, 70, EXPERIMENTAL, \ 111 "The cycle may shortcut when enough garbage can be reclaimed " \ 112 "from the immediate garbage (completely garbage regions). " \ 113 "In percents of total garbage found. Setting this threshold " \ 114 "to 100 effectively disables the shortcut.") \ 115 range(0,100) \ 116 \ 117 product(uintx, ShenandoahAdaptiveSampleFrequencyHz, 10, EXPERIMENTAL, \ 118 "The number of times per second to update the allocation rate " \ 119 "moving average.") \ 120 \ 121 product(uintx, ShenandoahAdaptiveSampleSizeSeconds, 10, EXPERIMENTAL, \ 122 "The size of the moving window over which the average " \ 123 "allocation rate is maintained. The total number of samples " \ 124 "is the product of this number and the sample frequency.") \ 125 \ 126 product(double, ShenandoahAdaptiveInitialConfidence, 1.8, EXPERIMENTAL, \ 127 "The number of standard deviations used to determine an initial " \ 128 "margin of error for the average cycle time and average " \ 129 "allocation rate. Increasing this value will cause the " \ 130 "heuristic to initiate more concurrent cycles." ) \ 131 \ 132 product(double, ShenandoahAdaptiveInitialSpikeThreshold, 1.8, EXPERIMENTAL, \ 133 "If the most recently sampled allocation rate is more than " \ 134 "this many standard deviations away from the moving average, " \ 135 "then a cycle is initiated. This value controls how sensitive " \ 136 "the heuristic is to allocation spikes. Decreasing this number " \ 137 "increases the sensitivity. ") \ 138 \ 139 product(double, ShenandoahAdaptiveDecayFactor, 0.5, EXPERIMENTAL, \ 140 "The decay factor (alpha) used for values in the weighted " \ 141 "moving average of cycle time and allocation rate. " \ 142 "Larger values give more weight to recent values.") \ 143 range(0,1.0) \ 144 \ 145 product(uintx, ShenandoahGuaranteedGCInterval, 5*60*1000, EXPERIMENTAL, \ 146 "Many heuristics would guarantee a concurrent GC cycle at " \ 147 "least with this interval. This is useful when large idle " \ 148 "intervals are present, where GC can run without stealing " \ 149 "time from active application. Time is in milliseconds. " \ 150 "Setting this to 0 disables the feature.") \ 151 \ 152 product(bool, ShenandoahAlwaysClearSoftRefs, false, EXPERIMENTAL, \ 153 "Unconditionally clear soft references, instead of using any " \ 154 "other cleanup policy. This minimizes footprint at expense of" \ 155 "more soft reference churn in applications.") \ 156 \ 157 product(bool, ShenandoahUncommit, true, EXPERIMENTAL, \ 158 "Allow to uncommit memory under unused regions and metadata. " \ 159 "This optimizes footprint at expense of allocation latency in " \ 160 "regions that require committing back. Uncommits would be " \ 161 "disabled by some heuristics, or with static heap size.") \ 162 \ 163 product(uintx, ShenandoahUncommitDelay, 5*60*1000, EXPERIMENTAL, \ 164 "Uncommit memory for regions that were not used for more than " \ 165 "this time. First use after that would incur allocation stalls. " \ 166 "Actively used regions would never be uncommitted, because they " \ 167 "do not become unused longer than this delay. Time is in " \ 168 "milliseconds. Setting this delay to 0 effectively uncommits " \ 169 "regions almost immediately after they become unused.") \ 170 \ 171 product(bool, ShenandoahRegionSampling, false, EXPERIMENTAL, \ 172 "Provide heap region sampling data via jvmstat.") \ 173 \ 174 product(int, ShenandoahRegionSamplingRate, 40, EXPERIMENTAL, \ 175 "Sampling rate for heap region sampling. In milliseconds between "\ 176 "the samples. Higher values provide more fidelity, at expense " \ 177 "of more sampling overhead.") \ 178 \ 179 product(uintx, ShenandoahControlIntervalMin, 1, EXPERIMENTAL, \ 180 "The minimum sleep interval for the control loop that drives " \ 181 "the cycles. Lower values would increase GC responsiveness " \ 182 "to changing heap conditions, at the expense of higher perf " \ 183 "overhead. Time is in milliseconds.") \ 184 \ 185 product(uintx, ShenandoahControlIntervalMax, 10, EXPERIMENTAL, \ 186 "The maximum sleep interval for control loop that drives " \ 187 "the cycles. Lower values would increase GC responsiveness " \ 188 "to changing heap conditions, at the expense of higher perf " \ 189 "overhead. Time is in milliseconds.") \ 190 \ 191 product(uintx, ShenandoahControlIntervalAdjustPeriod, 1000, EXPERIMENTAL, \ 192 "The time period for one step in control loop interval " \ 193 "adjustment. Lower values make adjustments faster, at the " \ 194 "expense of higher perf overhead. Time is in milliseconds.") \ 195 \ 196 product(bool, ShenandoahVerify, false, DIAGNOSTIC, \ 197 "Enable internal verification. This would catch many GC bugs, " \ 198 "but it would also stall the collector during the verification, " \ 199 "which prolongs the pauses and might hide other bugs.") \ 200 \ 201 product(intx, ShenandoahVerifyLevel, 4, DIAGNOSTIC, \ 202 "Verification level, higher levels check more, taking more time. "\ 203 "Accepted values are:" \ 204 " 0 = basic heap checks; " \ 205 " 1 = previous level, plus basic region checks; " \ 206 " 2 = previous level, plus all roots; " \ 207 " 3 = previous level, plus all reachable objects; " \ 208 " 4 = previous level, plus all marked objects") \ 209 \ 210 product(uintx, ShenandoahEvacReserve, 5, EXPERIMENTAL, \ 211 "How much of heap to reserve for evacuations. Larger values make "\ 212 "GC evacuate more live objects on every cycle, while leaving " \ 213 "less headroom for application to allocate in. In percents of " \ 214 "total heap size.") \ 215 range(1,100) \ 216 \ 217 product(double, ShenandoahEvacWaste, 1.2, EXPERIMENTAL, \ 218 "How much waste evacuations produce within the reserved space. " \ 219 "Larger values make evacuations more resilient against " \ 220 "evacuation conflicts, at expense of evacuating less on each " \ 221 "GC cycle.") \ 222 range(1.0,100.0) \ 223 \ 224 product(bool, ShenandoahEvacReserveOverflow, true, EXPERIMENTAL, \ 225 "Allow evacuations to overflow the reserved space. Enabling it " \ 226 "will make evacuations more resilient when evacuation " \ 227 "reserve/waste is incorrect, at the risk that application " \ 228 "runs out of memory too early.") \ 229 \ 230 product(bool, ShenandoahPacing, true, EXPERIMENTAL, \ 231 "Pace application allocations to give GC chance to start " \ 232 "and complete before allocation failure is reached.") \ 233 \ 234 product(uintx, ShenandoahPacingMaxDelay, 10, EXPERIMENTAL, \ 235 "Max delay for pacing application allocations. Larger values " \ 236 "provide more resilience against out of memory, at expense at " \ 237 "hiding the GC latencies in the allocation path. Time is in " \ 238 "milliseconds. Setting it to arbitrarily large value makes " \ 239 "GC effectively stall the threads indefinitely instead of going " \ 240 "to degenerated or Full GC.") \ 241 \ 242 product(uintx, ShenandoahPacingIdleSlack, 2, EXPERIMENTAL, \ 243 "How much of heap counted as non-taxable allocations during idle "\ 244 "phases. Larger value makes the pacing milder when collector is " \ 245 "idle, requiring less rendezvous with control thread. Lower " \ 246 "value makes the pacing control less responsive to out-of-cycle " \ 247 "allocs. In percent of total heap size.") \ 248 range(0, 100) \ 249 \ 250 product(uintx, ShenandoahPacingCycleSlack, 10, EXPERIMENTAL, \ 251 "How much of free space to take as non-taxable allocations " \ 252 "the GC cycle. Larger value makes the pacing milder at the " \ 253 "beginning of the GC cycle. Lower value makes the pacing less " \ 254 "uniform during the cycle. In percent of free space.") \ 255 range(0, 100) \ 256 \ 257 product(double, ShenandoahPacingSurcharge, 1.1, EXPERIMENTAL, \ 258 "Additional pacing tax surcharge to help unclutter the heap. " \ 259 "Larger values makes the pacing more aggressive. Lower values " \ 260 "risk GC cycles finish with less memory than were available at " \ 261 "the beginning of it.") \ 262 range(1.0, 100.0) \ 263 \ 264 product(uintx, ShenandoahCriticalFreeThreshold, 1, EXPERIMENTAL, \ 265 "How much of the heap needs to be free after recovery cycles, " \ 266 "either Degenerated or Full GC to be claimed successful. If this "\ 267 "much space is not available, next recovery step would be " \ 268 "triggered.") \ 269 range(0, 100) \ 270 \ 271 product(bool, ShenandoahDegeneratedGC, true, DIAGNOSTIC, \ 272 "Enable Degenerated GC as the graceful degradation step. " \ 273 "Disabling this option leads to degradation to Full GC instead. " \ 274 "When running in passive mode, this can be toggled to measure " \ 275 "either Degenerated GC or Full GC costs.") \ 276 \ 277 product(uintx, ShenandoahFullGCThreshold, 3, EXPERIMENTAL, \ 278 "How many back-to-back Degenerated GCs should happen before " \ 279 "going to a Full GC.") \ 280 \ 281 product(uintx, ShenandoahNoProgressThreshold, 5, EXPERIMENTAL, \ 282 "After this number of consecutive Full GCs fail to make " \ 283 "progress, Shenandoah will raise out of memory errors. Note " \ 284 "that progress is determined by ShenandoahCriticalFreeThreshold") \ 285 \ 286 product(bool, ShenandoahImplicitGCInvokesConcurrent, false, EXPERIMENTAL, \ 287 "Should internally-caused GC requests invoke concurrent cycles, " \ 288 "should they do the stop-the-world (Degenerated / Full GC)? " \ 289 "Many heuristics automatically enable this. This option is " \ 290 "similar to global ExplicitGCInvokesConcurrent.") \ 291 \ 292 product(bool, ShenandoahHumongousMoves, true, DIAGNOSTIC, \ 293 "Allow moving humongous regions. This makes GC more resistant " \ 294 "to external fragmentation that may otherwise fail other " \ 295 "humongous allocations, at the expense of higher GC copying " \ 296 "costs. Currently affects stop-the-world (Full) cycle only.") \ 297 \ 298 product(bool, ShenandoahOOMDuringEvacALot, false, DIAGNOSTIC, \ 299 "Testing: simulate OOM during evacuation.") \ 300 \ 301 product(bool, ShenandoahAllocFailureALot, false, DIAGNOSTIC, \ 302 "Testing: make lots of artificial allocation failures.") \ 303 \ 304 product(intx, ShenandoahMarkScanPrefetch, 32, EXPERIMENTAL, \ 305 "How many objects to prefetch ahead when traversing mark bitmaps."\ 306 "Set to 0 to disable prefetching.") \ 307 range(0, 256) \ 308 \ 309 product(uintx, ShenandoahMarkLoopStride, 1000, EXPERIMENTAL, \ 310 "How many items to process during one marking iteration before " \ 311 "checking for cancellation, yielding, etc. Larger values improve "\ 312 "marking performance at expense of responsiveness.") \ 313 \ 314 product(uintx, ShenandoahParallelRegionStride, 0, EXPERIMENTAL, \ 315 "How many regions to process at once during parallel region " \ 316 "iteration. Affects heaps with lots of regions. " \ 317 "Set to 0 to let Shenandoah to decide the best value.") \ 318 \ 319 product(size_t, ShenandoahSATBBufferSize, 1 * K, EXPERIMENTAL, \ 320 "Number of entries in an SATB log buffer.") \ 321 range(1, max_uintx) \ 322 \ 323 product(uintx, ShenandoahMaxSATBBufferFlushes, 5, EXPERIMENTAL, \ 324 "How many times to maximum attempt to flush SATB buffers at the " \ 325 "end of concurrent marking.") \ 326 \ 327 product(bool, ShenandoahSATBBarrier, true, DIAGNOSTIC, \ 328 "Turn on/off SATB barriers in Shenandoah") \ 329 \ 330 product(bool, ShenandoahCASBarrier, true, DIAGNOSTIC, \ 331 "Turn on/off CAS barriers in Shenandoah") \ 332 \ 333 product(bool, ShenandoahCloneBarrier, true, DIAGNOSTIC, \ 334 "Turn on/off clone barriers in Shenandoah") \ 335 \ 336 product(bool, ShenandoahLoadRefBarrier, true, DIAGNOSTIC, \ 337 "Turn on/off load-reference barriers in Shenandoah") \ 338 \ 339 product(bool, ShenandoahStackWatermarkBarrier, true, DIAGNOSTIC, \ 340 "Turn on/off stack watermark barriers in Shenandoah") \ 341 \ 342 develop(bool, ShenandoahVerifyOptoBarriers, trueInDebug, \ 343 "Verify no missing barriers in C2.") \ 344 \ 345 346 // end of GC_SHENANDOAH_FLAGS 347 348 #endif // SHARE_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP