1 /* 2 * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. 3 * Copyright (c) 2016, 2020, 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 diagnostic, \ 34 diagnostic_pd, \ 35 experimental, \ 36 notproduct, \ 37 manageable, \ 38 product_rw, \ 39 lp64_product, \ 40 range, \ 41 constraint) \ 42 \ 43 experimental(size_t, ShenandoahHeapRegionSize, 0, \ 44 "Size of the Shenandoah regions. Set to zero to detect " \ 45 "automatically.") \ 46 \ 47 experimental(size_t, ShenandoahTargetNumRegions, 2048, \ 48 "Target number of regions. We try to get around that many " \ 49 "regions, based on Shenandoah{Min,Max}RegionSize.") \ 50 \ 51 experimental(size_t, ShenandoahMinRegionSize, 256 * K, \ 52 "Minimum Shenandoah heap region size.") \ 53 \ 54 experimental(size_t, ShenandoahMaxRegionSize, 32 * M, \ 55 "Maximum Shenandoah heap region size.") \ 56 \ 57 experimental(intx, ShenandoahHumongousThreshold, 100, \ 58 "How large should the object be to get allocated in humongous " \ 59 "region, in percents of heap region size. This also caps the " \ 60 "maximum TLAB size.") \ 61 range(1, 100) \ 62 \ 63 experimental(ccstr, ShenandoahGCHeuristics, "adaptive", \ 64 "The heuristics to use in Shenandoah GC. Possible values:" \ 65 " *) adaptive - adapt to maintain the given amount of free heap;" \ 66 " *) static - start concurrent GC when static free heap " \ 67 " threshold and static allocation threshold are " \ 68 " tripped;" \ 69 " *) aggressive - run concurrent GC continuously, evacuate " \ 70 " everything;" \ 71 " *) compact - run GC with lower footprint target, may end up " \ 72 " doing continuous GC, evacuate lots of live " \ 73 " objects, uncommit heap aggressively;") \ 74 \ 75 experimental(ccstr, ShenandoahGCMode, "normal", \ 76 "The GC mode to use in Shenandoah GC. Possible values" \ 77 " *) normal - normal GC (mark-evac-update)" \ 78 " *) traversal - traversal GC (single-pass)" \ 79 " *) passive - disable concurrent GC, do stop-the-world GC") \ 80 \ 81 experimental(ccstr, ShenandoahUpdateRefsEarly, "adaptive", \ 82 "Run a separate concurrent reference updating phase after" \ 83 "concurrent evacuation. Possible values: 'on', 'off', 'adaptive'")\ 84 \ 85 experimental(uintx, ShenandoahRefProcFrequency, 5, \ 86 "How often should (weak, soft, etc) references be processed. " \ 87 "References get processed at every Nth GC cycle. Set to zero " \ 88 "to disable reference processing.") \ 89 \ 90 experimental(uintx, ShenandoahUnloadClassesFrequency, 1, \ 91 "How often should classes get unloaded. " \ 92 "Class unloading is performed at every Nth GC cycle. " \ 93 "Set to zero to disable class unloading during concurrent GC.") \ 94 \ 95 experimental(uintx, ShenandoahGarbageThreshold, 60, \ 96 "Sets the percentage of garbage a region need to contain before " \ 97 "it can be marked for collection. Does not apply to all " \ 98 "heuristics.") \ 99 range(0,100) \ 100 \ 101 experimental(uintx, ShenandoahInitFreeThreshold, 70, \ 102 "Initial remaining free heap threshold for learning steps in " \ 103 "heuristics. In percents of total heap size. Does not apply to " \ 104 "all heuristics.") \ 105 range(0,100) \ 106 \ 107 experimental(uintx, ShenandoahMinFreeThreshold, 10, \ 108 "Minimum remaining free space threshold, after which collection " \ 109 "definitely triggers. Does not apply to all heuristics.") \ 110 range(0,100) \ 111 \ 112 experimental(uintx, ShenandoahAllocationThreshold, 0, \ 113 "Set percentage of memory allocated since last GC cycle before " \ 114 "a new GC cycle can be started. Set to zero to effectively " \ 115 "disable.") \ 116 range(0,100) \ 117 \ 118 experimental(uintx, ShenandoahLearningSteps, 5, \ 119 "Number of GC cycles to run in order to learn application " \ 120 "and GC performance for adaptive heuristics.") \ 121 range(0,100) \ 122 \ 123 experimental(uintx, ShenandoahImmediateThreshold, 90, \ 124 "If mark identifies more than this much immediate garbage " \ 125 "regions, it shall recycle them, and shall not continue the " \ 126 "rest of the GC cycle. The value is in percents of total " \ 127 "number of candidate regions for collection set. Setting this " \ 128 "threshold to 100% effectively disables this shortcut.") \ 129 range(0,100) \ 130 \ 131 experimental(uintx, ShenandoahMergeUpdateRefsMinGap, 100, \ 132 "If GC is currently running in separate update-refs mode " \ 133 "this numbers gives the threshold when to switch to " \ 134 "merged update-refs mode. Number is percentage relative to" \ 135 "duration(marking)+duration(update-refs).") \ 136 \ 137 experimental(uintx, ShenandoahMergeUpdateRefsMaxGap, 200, \ 138 "If GC is currently running in merged update-refs mode " \ 139 "this numbers gives the threshold when to switch to " \ 140 "separate update-refs mode. Number is percentage relative " \ 141 "to duration(marking)+duration(update-refs).") \ 142 \ 143 experimental(uintx, ShenandoahGuaranteedGCInterval, 5*60*1000, \ 144 "Most heuristics would guarantee a concurrent GC cycle at " \ 145 "least with this interval. This is useful when large idle " \ 146 "intervals are present, where GC can run without stealing " \ 147 "time from active application. Time is in milliseconds. " \ 148 "(Setting this interval to 0 disables this feature).") \ 149 \ 150 experimental(bool, ShenandoahAlwaysClearSoftRefs, false, \ 151 "Clear soft references always, instead of using any smart " \ 152 "cleanup policy. This minimizes footprint at expense of more " \ 153 "softref churn in applications.") \ 154 \ 155 experimental(bool, ShenandoahUncommit, true, \ 156 "Allow Shenandoah to uncommit unused memory.") \ 157 \ 158 experimental(uintx, ShenandoahUncommitDelay, 5*60*1000, \ 159 "Shenandoah would start to uncommit memory for regions that were" \ 160 " not used for more than this time. First use after that would " \ 161 "incur allocation stalls. Actively used regions would never be " \ 162 "uncommitted, because they never decay. Time is in milliseconds." \ 163 "Setting this delay to 0 effectively makes Shenandoah to " \ 164 "uncommit the regions almost immediately.") \ 165 \ 166 experimental(bool, ShenandoahRegionSampling, false, \ 167 "Turns on heap region sampling via JVMStat") \ 168 \ 169 experimental(int, ShenandoahRegionSamplingRate, 40, \ 170 "Sampling rate for heap region sampling. " \ 171 "Number of milliseconds between samples") \ 172 \ 173 experimental(uintx, ShenandoahControlIntervalMin, 1, \ 174 "The minumum sleep interval for control loop that drives " \ 175 "the cycles. Lower values would increase GC responsiveness " \ 176 "to changing heap conditions, at the expense of higher perf " \ 177 "overhead. Time is in milliseconds.") \ 178 \ 179 experimental(uintx, ShenandoahControlIntervalMax, 10, \ 180 "The maximum sleep interval for 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 experimental(uintx, ShenandoahControlIntervalAdjustPeriod, 1000, \ 186 "The time period for one step in control loop interval " \ 187 "adjustment. Lower values make adjustments faster, at the " \ 188 "expense of higher perf overhead. Time is in milliseconds.") \ 189 \ 190 experimental(bool, ShenandoahCriticalControlThreadPriority, false, \ 191 "Shenandoah control thread runs at critical scheduling priority.")\ 192 \ 193 diagnostic(bool, ShenandoahVerify, false, \ 194 "Verify the Shenandoah garbage collector") \ 195 \ 196 diagnostic(intx, ShenandoahVerifyLevel, 4, \ 197 "Shenandoah verification level: " \ 198 "0 = basic heap checks; " \ 199 "1 = previous level, plus basic region checks; " \ 200 "2 = previous level, plus all roots; " \ 201 "3 = previous level, plus all reachable objects; " \ 202 "4 = previous level, plus all marked objects") \ 203 \ 204 diagnostic(bool, ShenandoahElasticTLAB, true, \ 205 "Use Elastic TLABs with Shenandoah") \ 206 \ 207 diagnostic(bool, ShenandoahAllowMixedAllocs, true, \ 208 "Allow mixing mutator and collector allocations in a single " \ 209 "region") \ 210 \ 211 experimental(uintx, ShenandoahAllocSpikeFactor, 5, \ 212 "The amount of heap space to reserve for absorbing the " \ 213 "allocation spikes. Larger value wastes more memory in " \ 214 "non-emergency cases, but provides more safety in emergency " \ 215 "cases. In percents of total heap size.") \ 216 range(0,100) \ 217 \ 218 experimental(uintx, ShenandoahEvacReserve, 5, \ 219 "Maximum amount of free space to reserve for evacuation. " \ 220 "Larger values make GC more aggressive, while leaving less " \ 221 "headroom for application to allocate in. " \ 222 "In percents of total heap size.") \ 223 range(1,100) \ 224 \ 225 experimental(double, ShenandoahEvacWaste, 1.2, \ 226 "How much waste evacuations produce within the reserved " \ 227 "space. Larger values make evacuations more resilient " \ 228 "against allocation failures, at expense of smaller csets " \ 229 "on each cycle.") \ 230 range(1.0,100.0) \ 231 \ 232 experimental(bool, ShenandoahEvacReserveOverflow, true, \ 233 "Allow evacuations to overflow the reserved space. " \ 234 "Enabling it will make evacuations more resilient when " \ 235 "evacuation reserve/waste is incorrect, at the risk that " \ 236 "application allocations run out of memory too early.") \ 237 \ 238 diagnostic(bool, ShenandoahAllocationTrace, false, \ 239 "Trace allocation latencies and stalls. Can be expensive when " \ 240 "lots of allocations happen, and may introduce scalability " \ 241 "bottlenecks.") \ 242 \ 243 diagnostic(intx, ShenandoahAllocationStallThreshold, 10000, \ 244 "When allocation tracing is enabled, the allocation stalls " \ 245 "larger than this threshold would be reported as warnings. " \ 246 "Time is in microseconds.") \ 247 \ 248 experimental(uintx, ShenandoahEvacAssist, 10, \ 249 "How many objects to evacuate on LRB assist path. " \ 250 "Use zero to disable.") \ 251 \ 252 experimental(bool, ShenandoahPacing, true, \ 253 "Pace application allocations to give GC chance to start " \ 254 "and complete before allocation failure is reached.") \ 255 \ 256 experimental(uintx, ShenandoahPacingMaxDelay, 10, \ 257 "Max delay for pacing application allocations. " \ 258 "Time is in milliseconds.") \ 259 \ 260 experimental(uintx, ShenandoahPacingIdleSlack, 2, \ 261 "Percent of heap counted as non-taxable allocations during idle. "\ 262 "Larger value makes the pacing milder during idle phases, " \ 263 "requiring less rendezvous with control thread. Lower value " \ 264 "makes the pacing control less responsive to out-of-cycle allocs.")\ 265 range(0, 100) \ 266 \ 267 experimental(uintx, ShenandoahPacingCycleSlack, 10, \ 268 "Percent of free space taken as non-taxable allocations during " \ 269 "the GC cycle. Larger value makes the pacing milder at the " \ 270 "beginning of the GC cycle. Lower value makes the pacing less " \ 271 "uniform during the cycle.") \ 272 range(0, 100) \ 273 \ 274 experimental(double, ShenandoahPacingSurcharge, 1.1, \ 275 "Additional pacing tax surcharge to help unclutter the heap. " \ 276 "Larger values makes the pacing more aggressive. Lower values " \ 277 "risk GC cycles finish with less memory than were available at " \ 278 "the beginning of it.") \ 279 range(1.0, 100.0) \ 280 \ 281 experimental(uintx, ShenandoahCriticalFreeThreshold, 1, \ 282 "Percent of heap that needs to be free after recovery cycles, " \ 283 "either Degenerated or Full GC. If this much space is not " \ 284 "available, next recovery step would triggered.") \ 285 range(0, 100) \ 286 \ 287 diagnostic(bool, ShenandoahDegeneratedGC, true, \ 288 "Use Degenerated GC as the graceful degradation step. Disabling " \ 289 "this leads to degradation to Full GC") \ 290 \ 291 experimental(uintx, ShenandoahFullGCThreshold, 3, \ 292 "How many back-to-back Degenerated GCs to do before triggering " \ 293 "a Full GC.") \ 294 \ 295 experimental(bool, ShenandoahImplicitGCInvokesConcurrent, false, \ 296 "Should internally-caused GCs invoke concurrent cycles, or go to" \ 297 "stop-the-world (degenerated/full)?") \ 298 \ 299 diagnostic(bool, ShenandoahHumongousMoves, true, \ 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 diagnostic(bool, ShenandoahOOMDuringEvacALot, false, \ 306 "Simulate OOM during evacuation frequently.") \ 307 \ 308 diagnostic(bool, ShenandoahAllocFailureALot, false, \ 309 "Make lots of artificial allocation failures.") \ 310 \ 311 diagnostic(bool, ShenandoahTerminationTrace, false, \ 312 "Tracing task termination timings") \ 313 \ 314 diagnostic(bool, ShenandoahAlwaysPreTouch, false, \ 315 "Pre-touch heap memory, overrides global AlwaysPreTouch") \ 316 \ 317 experimental(intx, ShenandoahMarkScanPrefetch, 32, \ 318 "How many objects to prefetch ahead when traversing mark bitmaps."\ 319 "Set to 0 to disable prefetching.") \ 320 range(0, 256) \ 321 \ 322 experimental(uintx, ShenandoahMarkLoopStride, 1000, \ 323 "How many items are processed during one marking step") \ 324 \ 325 experimental(uintx, ShenandoahParallelRegionStride, 1024, \ 326 "How many regions are processed in one stride during parallel " \ 327 "iteration.") \ 328 \ 329 experimental(size_t, ShenandoahSATBBufferSize, 1 * K, \ 330 "Number of entries in an SATB log buffer.") \ 331 range(1, max_uintx) \ 332 \ 333 experimental(uintx, ShenandoahSATBBufferFlushInterval, 100, \ 334 "Forcefully flush non-empty SATB buffers at this interval. " \ 335 "Time is in milliseconds.") \ 336 \ 337 experimental(uint, ShenandoahParallelSafepointThreads, 4, \ 338 "Number of parallel threads used for safepoint prolog/epilog") \ 339 \ 340 diagnostic(bool, ShenandoahPreclean, true, \ 341 "Do concurrent preclean phase before final mark: process " \ 342 "definitely alive references to avoid dealing with them during " \ 343 "pause.") \ 344 \ 345 experimental(bool, ShenandoahSuspendibleWorkers, false, \ 346 "Suspend concurrent GC worker threads at safepoints") \ 347 \ 348 diagnostic(bool, ShenandoahSATBBarrier, true, \ 349 "Turn on/off SATB barriers in Shenandoah") \ 350 \ 351 diagnostic(bool, ShenandoahKeepAliveBarrier, true, \ 352 "Turn on/off keep alive barriers in Shenandoah") \ 353 \ 354 diagnostic(bool, ShenandoahStoreValEnqueueBarrier, false, \ 355 "Turn on/off enqueuing of oops for storeval barriers") \ 356 \ 357 diagnostic(bool, ShenandoahCASBarrier, true, \ 358 "Turn on/off CAS barriers in Shenandoah") \ 359 \ 360 diagnostic(bool, ShenandoahCloneBarrier, true, \ 361 "Turn on/off clone barriers in Shenandoah") \ 362 \ 363 diagnostic(bool, ShenandoahLoadRefBarrier, true, \ 364 "Turn on/off load-reference barriers in Shenandoah") \ 365 \ 366 diagnostic(bool, ShenandoahConcurrentScanCodeRoots, true, \ 367 "Scan code roots concurrently, instead of during a pause") \ 368 \ 369 diagnostic(uintx, ShenandoahCodeRootsStyle, 2, \ 370 "Use this style to scan code cache:" \ 371 " 0 - sequential iterator;" \ 372 " 1 - parallel iterator;" \ 373 " 2 - parallel iterator with cset filters;") \ 374 \ 375 diagnostic(bool, ShenandoahOptimizeStaticFinals, true, \ 376 "Optimize barriers on static final fields. " \ 377 "Turn it off for maximum compatibility with reflection or JNI " \ 378 "code that manipulates final fields.") \ 379 \ 380 experimental(bool, ShenandoahCommonGCStateLoads, false, \ 381 "Enable commonming for GC state loads in generated code.") \ 382 \ 383 develop(bool, ShenandoahVerifyOptoBarriers, false, \ 384 "Verify no missing barriers in C2") \ 385 \ 386 diagnostic(bool, ShenandoahLoopOptsAfterExpansion, true, \ 387 "Attempt more loop opts after barrier expansion") \ 388 \ 389 diagnostic(bool, ShenandoahSelfFixing, true, \ 390 "Fix references with load reference barrier. Disabling this " \ 391 "might degrade performance.") \ 392 393 394 #endif // SHARE_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP