RFR: 8329223: Parallel: Parallel GC resizes heap even if -Xms = -Xmx [v7]
Zhengyu Gu
zgu at openjdk.org
Thu Apr 25 13:42:32 UTC 2024
On Thu, 25 Apr 2024 10:00:16 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:
>> Debugging with following command line:
>> `make CONF=macosx-aarch64-server-fastdebug run-test TEST=gtest TEST_VM_OPTS="-Xlog:gc+heap=trace"`
>>
>> With `initial_old_size = MinOldSize` fails this test:
>>
>> ```
>> // If OldSize is set on the command line, it should be used
>> // for both min and initial old size if less than min heap.
>> TestGenCollectorPolicy::SetOldSizeCmd setter(20 * M);
>>
>> TestGenCollectorPolicy::CheckOldMin checker_min(20 * M);
>> TestGenCollectorPolicy::TestWrapper::test(&setter, &checker_min);
>>
>>
>> Debug output:
>>
>> [0.001s][trace][gc,heap] Maximum heap size 8589934592
>> [0.001s][trace][gc,heap] Initial heap size 536870912
>> [0.001s][trace][gc,heap] Minimum heap size 6815736
>> [0.008s][debug][gc,heap] Minimum heap 8388608 Initial heap 536870912 Maximum heap 8589934592
>> [0.036s][debug][gc,heap] Minimum heap 41943040 Initial heap 109051904 Maximum heap 8589934592
>> [0.036s][trace][gc,heap] 1: Minimum young 196608 Initial young 36306944 Maximum young 83886080
>> [0.036s][warning][gc,ergo] Inconsistency between initial old size and minimum old size
>> [0.036s][warning][gc,ergo] Inconsistency between generation sizes and heap size, resizing the generations to fit the heap.
>> [0.036s][trace ][gc,heap] 2: Minimum young 196608 Initial young 67305472 Maximum young 83886080
>> [0.036s][trace ][gc,heap] Minimum old 41746432 Initial old 41746432 Maximum old 8506048512
>> /Users/zhengyu.gu/ws/jdk/test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp:261: Failure
>>
>>
>>
>> With `MinOldSize = initial_old_size`
>>
>> Debug output:
>>
>>
>> [0.001s][trace][gc,heap] Maximum heap size 8589934592
>> [0.001s][trace][gc,heap] Initial heap size 536870912
>> [0.001s][trace][gc,heap] Minimum heap size 6815736
>> [0.007s][debug][gc,heap] Minimum heap 8388608 Initial heap 536870912 Maximum heap 8589934592
>> [0.034s][debug][gc,heap] Minimum heap 41943040 Initial heap 109051904 Maximum heap 8589934592
>> [0.034s][trace][gc,heap] 1: Minimum young 196608 Initial young 36306944 Maximum young 83886080
>> [0.034s][warning][gc,ergo] Inconsistency between initial old size and minimum old size
>> [0.034s][warning][gc,ergo] Inconsistency between generation sizes and heap size, resizing the generations to fit the heap.
>> [0.034s][trace ][gc,heap] 2: Minimum young 196608 Initial young 83886080 Maximum young 83886080
>> [0.034s][trace ][gc,heap] Minimum old 20971520 Initial old 25165824 Maximum old 8506048512
>>
>>
>>
>> I will reverse b...
>
> I can see these lines are diff:
>
>
> [0.036s][trace ][gc,heap] 2: Minimum young 196608 Initial young 67305472 Maximum young 83886080
> [0.036s][trace ][gc,heap] Minimum old 41746432 Initial old 41746432 Maximum old 8506048512
>
>
> vs
>
>
> [0.034s][trace ][gc,heap] 2: Minimum young 196608 Initial young 83886080 Maximum young 83886080
> [0.034s][trace ][gc,heap] Minimum old 20971520 Initial old 25165824 Maximum old 8506048512
>
>
> Does that mean using values from the problematic case, sth like `-XX:MinHeapSize=41943040 -XX:InitialHeapSize=109051904 -XX:MaxHeapSize=8589934592 -XX:NewSize=67305472 -XX:MaxNewSize=83886080 -XX:OldSize=20m`, one would get failure on launching java from cmdline on macosx-aarch64? (These values from the log are printed after they are adjusted as I read the code, so the actual cmdline flag values might not be diff. If you can reproduce the failure consistently on your box, further instrumenting might be required.)
>
> It's still unclear to how the failure is triggered. Therefore, I can't say whether `MinOldSize = initial_old_size` fixes the issue, or just hides it.
No, I believe it is the weirdness of the gtest. If I run from command line, both yield the same results:
`initial_old_size = MinOldSize`
MREM54BA45D6:hotspot zhengyu.gu$ $TEST_JDK/bin/java -XX:MinHeapSize=41943040 -XX:InitialHeapSize=109051904 -XX:MaxHeapSize=8589934592 -XX:NewSize=67305472 -XX:MaxNewSize=83886080 -XX:OldSize=20m -XX:+UseParallelGC -Xlog:gc+ergo,gc+heap=trace -version
[0.011s][debug][gc,heap] Minimum heap 41943040 Initial heap 109051904 Maximum heap 8589934592
[0.011s][trace][gc,heap] 1: Minimum young 41418752 Initial young 67108864 Maximum young 83886080
[0.011s][warning][gc,ergo] Inconsistency between generation sizes and heap size, resizing the generations to fit the heap.
[0.011s][trace ][gc,heap] 2: Minimum young 41418752 Initial young 83886080 Maximum young 83886080
[0.011s][trace ][gc,heap] Minimum old 524288 Initial old 25165824 Maximum old 8506048512
openjdk version "23-internal" 2024-09-17
OpenJDK Runtime Environment (fastdebug build 23-internal-adhoc.zhengyugu.jdk)
OpenJDK 64-Bit Server VM (fastdebug build 23-internal-adhoc.zhengyugu.jdk, mixed mode, sharing)
MREM54BA45D6:hotspot zhengyu.gu$ $TEST_JDK/bin/java -XX:OldSize=20m -XX:+UseParallelGC -Xlog:gc+ergo,gc+heap=trace -version
[0.001s][trace][gc,heap] Maximum heap size 8589934592
[0.001s][trace][gc,heap] Initial heap size 536870912
[0.001s][trace][gc,heap] Minimum heap size 22334664
[0.010s][debug][gc,heap] Minimum heap 25165824 Initial heap 536870912 Maximum heap 8589934592
[0.010s][trace][gc,heap] 1: Minimum young 1572864 Initial young 515899392 Maximum young 2863136768
[0.010s][trace][gc,heap] Minimum old 20971520 Initial old 20971520 Maximum old 5726797824
openjdk version "23-internal" 2024-09-17
OpenJDK Runtime Environment (fastdebug build 23-internal-adhoc.zhengyugu.jdk)
OpenJDK 64-Bit Server VM (fastdebug build 23-internal-adhoc.zhengyugu.jdk, mixed mode, sharing)
`MinOldSize = initial_old_size;`
MREM54BA45D6:hotspot zhengyu.gu$ $TEST_JDK/bin/java -XX:MinHeapSize=41943040 -XX:InitialHeapSize=109051904 -XX:MaxHeapSize=8589934592 -XX:NewSize=67305472 -XX:MaxNewSize=83886080 -XX:OldSize=20m -XX:+UseParallelGC -Xlog:gc+ergo,gc+heap=trace -version
[0.014s][debug][gc,heap] Minimum heap 41943040 Initial heap 109051904 Maximum heap 8589934592
[0.014s][trace][gc,heap] 1: Minimum young 41418752 Initial young 67108864 Maximum young 83886080
[0.014s][warning][gc,ergo] Inconsistency between generation sizes and heap size, resizing the generations to fit the heap.
[0.014s][trace ][gc,heap] 2: Minimum young 41418752 Initial young 83886080 Maximum young 83886080
[0.014s][trace ][gc,heap] Minimum old 524288 Initial old 25165824 Maximum old 8506048512
openjdk version "23-internal" 2024-09-17
OpenJDK Runtime Environment (fastdebug build 23-internal-adhoc.zhengyugu.jdk)
OpenJDK 64-Bit Server VM (fastdebug build 23-internal-adhoc.zhengyugu.jdk, mixed mode, sharing)
MREM54BA45D6:hotspot zhengyu.gu$ $TEST_JDK/bin/java -XX:OldSize=20m -XX:+UseParallelGC -Xlog:gc+ergo,gc+heap=trace -version
[0.002s][trace][gc,heap] Maximum heap size 8589934592
[0.002s][trace][gc,heap] Initial heap size 536870912
[0.002s][trace][gc,heap] Minimum heap size 22334664
[0.015s][debug][gc,heap] Minimum heap 25165824 Initial heap 536870912 Maximum heap 8589934592
[0.015s][trace][gc,heap] 1: Minimum young 1572864 Initial young 515899392 Maximum young 2863136768
[0.015s][trace][gc,heap] Minimum old 20971520 Initial old 20971520 Maximum old 5726797824
openjdk version "23-internal" 2024-09-17
OpenJDK Runtime Environment (fastdebug build 23-internal-adhoc.zhengyugu.jdk)
OpenJDK 64-Bit Server VM (fastdebug build 23-internal-adhoc.zhengyugu.jdk, mixed mode, sharing)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18539#discussion_r1579492865
More information about the hotspot-gc-dev
mailing list