RFR: 8190283 - Default heap sizing options select a MaxHeapSize larger than available physical memory in some case

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

RFR: 8190283 - Default heap sizing options select a MaxHeapSize larger than available physical memory in some case

Bob Vandette
Please review this simple change that alters the algorithm for selecting the
default heap size on low (~100MB) memory environments.

This issue is blocking the integration of the container improvements (https://bugs.openjdk.java.net/browse/JDK-8146115 <https://bugs.openjdk.java.net/browse/JDK-8146115>).


BUG:
https://bugs.openjdk.java.net/browse/JDK-8190283 <https://bugs.openjdk.java.net/browse/JDK-8190283>

WEBREV:
http://bussund0417.us.oracle.com/export/users/bobv/jdk10hs-base/open/webrev/ <http://bussund0417.us.oracle.com/export/users/bobv/jdk10hs-base/open/webrev/>

Bob.

Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8190283 - Default heap sizing options select a MaxHeapSize larger than available physical memory in some case

Bob Vandette
I realized that I didn’t post the webrev on our external server.  There was only 1 file changed.
Here’s the diff:

*** old/src/hotspot/share/runtime/arguments.cpp Fri Nov  3 11:50:07 2017
--- new/src/hotspot/share/runtime/arguments.cpp Fri Nov  3 11:50:07 2017

*** 2086,2098 ****
--- 2086,2099 ----
    // If the maximum heap size has not been set with -Xmx,
    // then set it as fraction of the size of physical memory,
    // respecting the maximum and minimum sizes of the heap.
    if (FLAG_IS_DEFAULT(MaxHeapSize)) {
      julong reasonable_max = (julong)((phys_mem * MaxRAMPercentage) / 100);
      if (phys_mem <= (julong)((MaxHeapSize * MinRAMPercentage) / 100)) {
+     const julong reasonable_min = (julong)((phys_mem * MinRAMPercentage) / 100);
+     if (reasonable_min < MaxHeapSize) {
        // Small physical memory, so use a minimum fraction of it for the heap
!       reasonable_max = (julong)((phys_mem * MinRAMPercentage) / 100);
!       reasonable_max = reasonable_min;
      } else {
        // Not-small physical memory, so require a heap at least
        // as large as MaxHeapSize
        reasonable_max = MAX2(reasonable_max, (julong)MaxHeapSize);
      }
Bob

> On Nov 3, 2017, at 11:58 AM, Bob Vandette <[hidden email]> wrote:
>
> Please review this simple change that alters the algorithm for selecting the
> default heap size on low (~100MB) memory environments.
>
> This issue is blocking the integration of the container improvements (https://bugs.openjdk.java.net/browse/JDK-8146115 <https://bugs.openjdk.java.net/browse/JDK-8146115>).
>
>
> BUG:
> https://bugs.openjdk.java.net/browse/JDK-8190283 <https://bugs.openjdk.java.net/browse/JDK-8190283>
>
> WEBREV:
> http://bussund0417.us.oracle.com/export/users/bobv/jdk10hs-base/open/webrev/ <http://bussund0417.us.oracle.com/export/users/bobv/jdk10hs-base/open/webrev/>
>
> Bob.
>

Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8190283 - Default heap sizing options select a MaxHeapSize larger than available physical memory in some case

Bob Vandette

> On Nov 3, 2017, at 12:42 PM, Bob Vandette <[hidden email]> wrote:
>
> I realized that I didn’t post the webrev on our external server.  There was only 1 file changed.
> Here’s the diff:
>
> *** old/src/hotspot/share/runtime/arguments.cpp Fri Nov  3 11:50:07 2017
> --- new/src/hotspot/share/runtime/arguments.cpp Fri Nov  3 11:50:07 2017
>
> *** 2086,2098 ****
> --- 2086,2099 ----
>    // If the maximum heap size has not been set with -Xmx,
>    // then set it as fraction of the size of physical memory,
>    // respecting the maximum and minimum sizes of the heap.
>    if (FLAG_IS_DEFAULT(MaxHeapSize)) {
>      julong reasonable_max = (julong)((phys_mem * MaxRAMPercentage) / 100);
>      if (phys_mem <= (julong)((MaxHeapSize * MinRAMPercentage) / 100)) {
> +     const julong reasonable_min = (julong)((phys_mem * MinRAMPercentage) / 100);
> +     if (reasonable_min < MaxHeapSize) {
>        // Small physical memory, so use a minimum fraction of it for the heap
> !       reasonable_max = (julong)((phys_mem * MinRAMPercentage) / 100);
> !       reasonable_max = reasonable_min;
>      } else {
>        // Not-small physical memory, so require a heap at least
>        // as large as MaxHeapSize
>        reasonable_max = MAX2(reasonable_max, (julong)MaxHeapSize);
>      }
> Bob
>
>> On Nov 3, 2017, at 11:58 AM, Bob Vandette <[hidden email]> wrote:
>>
>> Please review this simple change that alters the algorithm for selecting the
>> default heap size on low (~100MB) memory environments.
>>
>> This issue is blocking the integration of the container improvements (https://bugs.openjdk.java.net/browse/JDK-8146115 <https://bugs.openjdk.java.net/browse/JDK-8146115>).
>>
>>
>> BUG:
>> https://bugs.openjdk.java.net/browse/JDK-8190283 <https://bugs.openjdk.java.net/browse/JDK-8190283>
>>
>> WEBREV:
>> http://bussund0417.us.oracle.com/export/users/bobv/jdk10hs-base/open/webrev/ <http://bussund0417.us.oracle.com/export/users/bobv/jdk10hs-base/open/webrev/>
>>
>> Bob.
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8190283 - Default heap sizing options select a MaxHeapSize larger than available physical memory in some case

Thomas Schatzl
In reply to this post by Bob Vandette
Hi Bob,

On Fri, 2017-11-03 at 11:58 -0400, Bob Vandette wrote:

> Please review this simple change that alters the algorithm for
> selecting the
> default heap size on low (~100MB) memory environments.
>
> This issue is blocking the integration of the container improvements
> (https://bugs.openjdk.java.net/browse/JDK-8146115).
>
>
> BUG:
> https://bugs.openjdk.java.net/browse/JDK-8190283
>
> WEBREV:
> http://bussund0417.us.oracle.com/export/users/bobv/jdk10hs-base/open/
> webrev/
>
>

  looks good. :D

Thomas
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8190283 - Default heap sizing options select a MaxHeapSize larger than available physical memory in some case

Stefan Johansson


On 2017-11-03 19:55, Thomas Schatzl wrote:

> Hi Bob,
>
> On Fri, 2017-11-03 at 11:58 -0400, Bob Vandette wrote:
>> Please review this simple change that alters the algorithm for
>> selecting the
>> default heap size on low (~100MB) memory environments.
>>
>> This issue is blocking the integration of the container improvements
>> (https://bugs.openjdk.java.net/browse/JDK-8146115).
>>
>>
>> BUG:
>> https://bugs.openjdk.java.net/browse/JDK-8190283
>>
>> WEBREV:
>> http://bussund0417.us.oracle.com/export/users/bobv/jdk10hs-base/open/
>> webrev/
>>
>>
>    looks good. :D
+1
StefanJ
>
> Thomas