--- old/src/hotspot/share/gc/g1/g1Arguments.cpp 2018-04-13 11:50:27.941111466 +0200 +++ new/src/hotspot/share/gc/g1/g1Arguments.cpp 2018-04-13 11:50:27.663102946 +0200 @@ -126,6 +126,11 @@ log_trace(gc)("MarkStackSize: %uk MarkStackSizeMax: %uk", (unsigned int) (MarkStackSize / K), (uint) (MarkStackSizeMax / K)); + // By default do not let the target stack size to be more than 1/4 of the entries + if (FLAG_IS_DEFAULT(GCDrainStackTargetSize)) { + FLAG_SET_ERGO(uintx, GCDrainStackTargetSize, MIN2(GCDrainStackTargetSize, (uintx)TASKQUEUE_SIZE / 4)); + } + #ifdef COMPILER2 // Enable loop strip mining to offer better pause time guarantees if (FLAG_IS_DEFAULT(UseCountedLoopSafepoints)) {