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