RFR: 8047998: -XX:MaxNewSize is unnecessarily set to NewSize if NewSize is too low [v2]

Guoxiong Li gli at openjdk.org
Thu Jun 1 09:33:10 UTC 2023


> Hi all,
> 
> When `MaxHeapSize` is equal to `InitialHeapSize` and `NewSize` is set in command line,
> currently, the `max_young_size/MaxNewSize` will be set to the value of `NewSize`.
> 
> Considering the document of the `NewSize` (shown below), someone may set the `NewSize` 
> to a very small value and expect the JVM to adjust the value dynamically.
> Then when the `MaxHeapSize` is equal to `InitialHeapSize` (set by user or ergonomics),
> the `MaxNewSize` is set to the value of `NewSize`, which is small unexpectedly.
> 
> 
>   product(size_t, NewSize, ScaleForWordSize(1*M),                           \
>           "Initial new generation size (in bytes)")                         \
>           constraint(NewSizeConstraintFunc,AfterErgo)                       \
> 
> 
> This patch fixes the issue by setting the `MaxNewSize` to `NewSize` only when the `NewSize` 
> is larger than the original `max_young_size/MaxNewSize`.
> 
> The title of JDK-8047998 may need to adjusted.
> 
> Thanks for the review.
> 
> Best Regards,
> -- Guoxiong

Guoxiong Li has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:

 - Abort the vm instead of setting it implicitly.
 - Merge branch 'master' into JDK-8047998
 - JDK-8047998

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/13876/files
  - new: https://git.openjdk.org/jdk/pull/13876/files/5614f4d3..d86264c8

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=13876&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13876&range=00-01

  Stats: 159000 lines in 2768 files changed: 120360 ins; 19083 del; 19557 mod
  Patch: https://git.openjdk.org/jdk/pull/13876.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13876/head:pull/13876

PR: https://git.openjdk.org/jdk/pull/13876


More information about the hotspot-gc-dev mailing list