Re: G1 patch of elastic Java heap

Liang Mao at
Thu Sep 12 09:01:33 UTC 2019

Hi Thomas,

Sorry for some late to prepare the code. Now you can see the code in following webrev:
It contains 2 patchs of hotspot and jdk against OpenJDK 8u222-ga.
Most of the core source code is in src/share/vm/gc_implementation/g1/elasticHeap.cpp

I want to explain some brief ideas of the patch:
1. G1ElasticHeap provides no addtional STW time to existent GC pauses.
  The memory commit/uncommit(mmap/munmap) will be executed in a concurrent thread because
  mmap/munmap costs significant time(more than 100ms easily on GB memory).
2. We provides 3 different evaluation modes to do the memory saving.
    a. Generation limit
   The young generation and old generation can be limited respectively by jcmd/MXBean. 
        A typical scenario is that we have a lot of applications which have large young 
      generation(default G1 is 60% as well) which is prepared for peak traffic. We don't
       need the large young generation memory all the time if not in a peak traffic.
    b. Periodic uncommit
      The young/old generation will be uncommit respectively based on young/old GC interval.
       The idea is similar to the original JEP 346 but treats young/old generation separately.
       For example, an application doesn't need to have large young generation all the time as
      described above. Periodic uncommit will save young generation memory to keep an acceptable
      young GC interval.
    c. Softmx
   It adjust the capacity of heap in runtime by jcmd/MXBean.
3.We still have some limitations that we need to make sure Xms=Xmx and save the memory in different policy. 

  I made it a single patch so it may not be friendly for reading because of a lot of code and funcionalities.
 We can discuss a single feature like young generation uncommit or concurrent uncommit first. Please let me
know if you want me to explain more details on some specific points.


From:Thomas Schatzl <thomas.schatzl at>
Send Time:2019 Jun. 19 (Wed.) 18:04
To:"MAO, Liang" < at>; hotspot-gc-dev <hotspot-gc-dev at>
Subject:Re: G1 patch of elastic Java heap

Hi Liang,

On Wed, 2019-06-19 at 17:38 +0800, 毛亮(在弦) wrote:
> Hi Thomas,
> Thank you for your quick reply. 
> As we implemented this feature in AlibabaJDK8, do you think if it is
> feasible to just provide a CR based on JDK8? 
> So that you guys can have a look and then we can continue discussing
> on the possible JEP and implementations in upstream.
> Otherwise we need spend time on preparing patches based on tip for
> further discussion...
> BTW, I'm surely covered by the Alibaba OCA entry.

  for discussion a jdk8 patch/webrev is fine I guess. I would prefer a
webrev because it can be referenced more easily though.


More information about the hotspot-gc-dev mailing list