<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Vitaly,</p>
    <p>I am cc this to the dev list.</p>
    <p>My comments in line.<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 10/07/2016 10:27 AM, Vitaly
      Davidovich wrote:<br>
    </div>
    <blockquote
cite="mid:CAHjP37E457tZdpWaEFL2SX+MpuXA7o1L8kn3jRK7org9-EDeHg@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hi Jenny,
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On Fri, Oct 7, 2016 at 1:15 PM, <a
              moz-do-not-send="true" href="mailto:yu.zhang@oracle.com">yu.zhang@oracle.com</a>
            <span dir="ltr"><<a moz-do-not-send="true"
                href="mailto:yu.zhang@oracle.com" target="_blank">yu.zhang@oracle.com</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div bgcolor="#FFFFFF" text="#000000">
                <p>Hi, Vitaly,</p>
                <p>Here is what happens in jdk9(I think the logic is the
                  same as in jdk8).</p>
                _reserve_regions = reserve percent*regions of the heap<br>
                when trying to decide regions for young gen, we look at
                the free regions at the end of the collection, and try
                to honor the reserve_regions<br>
                if (available_free_regions > _reserve_regions) {<br>
                    base_free_regions = available_free_regions -
                _reserve_regions;<br>
                }<br>
                <br>
                And there are other constrains to consider: user defined
                constrains and pause time goal.<br>
                <br>
                This is what I meant by 'try to honor' the reserved. <br>
                If there is enough available_free_regions, it will
                reserve those regions. Those regions can be used as old
                or young.<br>
              </div>
            </blockquote>
            <div>Ok, thanks.  As you say, G1 *tries* to honor it, but
              may not.  The docs I've come across online make it sound
              like this reservation is a guarantee, or at least they
              don't stipulate the reservation may not work.  I don't
              know if it's worth clarifying that point or not, but my
              vote would be to make the docs err on the side of "more
              info" than less.</div>
          </div>
        </div>
      </div>
    </blockquote>
    Agree.<br>
    <blockquote
cite="mid:CAHjP37E457tZdpWaEFL2SX+MpuXA7o1L8kn3jRK7org9-EDeHg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div><br>
            </div>
            <div>The second part is what I mentioned to Charlie in my
              last reply - can humongous *allocations* be satisfied out
              of the reserve, or are the reserved regions only used to
              hold evacuees (when base_free_regions are not available).</div>
          </div>
        </div>
      </div>
    </blockquote>
    That is a good question. Here is my understanding, which need to be
    confirmed by G1 developer. In this code<br>
    HeapWord* G1CollectedHeap::humongous_obj_allocate(size_t word_size,
    AllocationContext_t context)<br>
    G1 tries to find regions from _free_list that can hold the humongous
    objects. The reserved regions are also on the _free_list (again need
    to be confirmed by developer). So my understanding is those reserved
    regions can be used as humongous allocation.<br>
    <br>
    But I might be missing something.<br>
    <br>
    <blockquote
cite="mid:CAHjP37E457tZdpWaEFL2SX+MpuXA7o1L8kn3jRK7org9-EDeHg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div><br>
            </div>
            <div>Thanks</div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div bgcolor="#FFFFFF" text="#000000"> <br>
                Jenny
                <div>
                  <div class="h5"><br>
                    <div class="m_1270621050554131485moz-cite-prefix">On
                      10/07/2016 09:51 AM, Vitaly Davidovich wrote:<br>
                    </div>
                    <blockquote type="cite">
                      <div dir="ltr">Hi Charlie,
                        <div class="gmail_extra"><br>
                          <div class="gmail_quote">On Fri, Oct 7, 2016
                            at 12:46 PM, charlie hunt <span dir="ltr"><<a
                                moz-do-not-send="true"
                                href="mailto:charlie.hunt@oracle.com"
                                target="_blank">charlie.hunt@oracle.com</a>></span>
                            wrote:<br>
                            <blockquote class="gmail_quote"
                              style="margin:0px 0px 0px
                              0.8ex;border-left:1px solid
                              rgb(204,204,204);padding-left:1ex">
                              <div style="word-wrap:break-word">Hi
                                Vitaly,
                                <div><br>
                                </div>
                                <div>Just to clarify things in case
                                  there might be some confusion … one of
                                  the terms in G1 can be a little
                                  confusing with a term used in Parallel
                                  GC, Serial GC and CMS GC, and that is
                                  “to-space”.  In the latter case,
                                  “to-space” is a survivor space. In G1,
                                  “to-space” is any space that a G1 is
                                  evacuating objects too.  So a
                                  “to-space exhausted” means that during
                                  an evacuation of live objects from a
                                  G1 region (which could be an eden
                                  region, survivor region or old
                                  region), and there is not an available
                                  region to evacuate those live objects,
                                  this constitutes a “to-space failure”.</div>
                                <div><br>
                                </div>
                                <div>I may be wrong, but my
                                  understanding is that once a humongous
                                  object is allocated, it is not
                                  evacuated. It stays in the same
                                  allocated region(s) until it is marked
                                  as being unreachable and can be
                                  reclaimed.</div>
                              </div>
                            </blockquote>
                            <div>Right, I understand the distinction in
                              terminology.</div>
                            <div><br>
                            </div>
                            <div>What I'm a bit confused by is when
                              Jenny said "<span
                                style="color:rgb(80,0,80)">I agree the
                                ReservePercent=40 is too high, but that
                                should not prevent allocating to the old
                                gen. G1 tries to honor ReservePercent."
                                 Specifically, the "G1 tries to honor
                                ReservePercent".  It wasn't clear to me
                                whether that implies humongous
                                allocations can look for contiguous
                                regions in the reserve, or not.  That's
                                what I'm hoping to get clarification on
                                since other sources online don't mention
                                G1ReservePercent playing a role for HO
                                specifically.</span></div>
                            <div><span style="color:rgb(80,0,80)"><br>
                              </span></div>
                            <div><span style="color:rgb(80,0,80)">Thanks</span></div>
                            <blockquote class="gmail_quote"
                              style="margin:0px 0px 0px
                              0.8ex;border-left:1px solid
                              rgb(204,204,204);padding-left:1ex">
                              <div style="word-wrap:break-word"><span
                                  class="m_1270621050554131485gmail-HOEnZb"><font
                                    color="#888888">
                                    <div><br>
                                    </div>
                                    <div>charlie</div>
                                  </font></span>
                                <div><br>
                                  <div>
                                    <blockquote type="cite">
                                      <div>
                                        <div
                                          class="m_1270621050554131485gmail-h5">
                                          <div>On Oct 7, 2016, at 11:00
                                            AM, Vitaly Davidovich <<a
                                              moz-do-not-send="true"
                                              href="mailto:vitalyd@gmail.com"
                                              target="_blank">vitalyd@gmail.com</a>>
                                            wrote:</div>
                                          <br
class="m_1270621050554131485gmail-m_2710312558409363290Apple-interchange-newline">
                                        </div>
                                      </div>
                                      <div>
                                        <div>
                                          <div
                                            class="m_1270621050554131485gmail-h5">
                                            <div dir="ltr">Hi Jenny,
                                              <div class="gmail_extra"><br>
                                                <div class="gmail_quote">On
                                                  Fri, Oct 7, 2016 at
                                                  11:52 AM, <a
                                                    moz-do-not-send="true"
href="mailto:yu.zhang@oracle.com" target="_blank">yu.zhang@oracle.com</a>
                                                  <span dir="ltr"><<a
moz-do-not-send="true" href="mailto:yu.zhang@oracle.com" target="_blank">yu.zhang@oracle.com</a>></span>
                                                  wrote:<br>
                                                  <blockquote
                                                    class="gmail_quote"
                                                    style="margin:0px
                                                    0px 0px
                                                    0.8ex;border-left:1px
                                                    solid
                                                    rgb(204,204,204);padding-left:1ex">
                                                    <div
                                                      bgcolor="#FFFFFF">
                                                      <p>Prasanna,</p>
                                                      <p>In addition to
                                                        what Vitaly
                                                        said, I have
                                                        some comments
                                                        about your
                                                        question:</p>
                                                      <span>
                                                        <p><span
                                                          style="font-size:10.5pt"><span>1)<span>    
                                                          </span></span></span><span
style="font-size:10.5pt"> Humongus allocation request for 72 mb failed,
                                                          from the logs
                                                          we can also
                                                          see we have
                                                          free space of
                                                           around 3 GB.
                                                          Does this
                                                          means , our
                                                          application is
                                                          encountering
                                                          high  amount
                                                          of
                                                          fragmentation
                                                          ?. <br>
                                                          </span></p>
                                                      </span>
                                                      <p>It is possible.
                                                        What it means is
                                                        g1 can not find
                                                        36 consecutive
                                                        regions for that
                                                        72 mb object.<br>
                                                      </p>
                                                      <p> I agree the
                                                        ReservePercent=40
                                                        is too high, but
                                                        that should not
                                                        prevent
                                                        allocating to
                                                        the old gen. G1
                                                        tries to honor
                                                        ReservePercent.</p>
                                                    </div>
                                                  </blockquote>
                                                  <div>So just to
                                                    clarify - is the
                                                    space (i.e. regions)
                                                    reserved by
                                                    G1ReservePercent
                                                    allocatable to
                                                    humongous object
                                                    allocations? All
                                                    docs/webpages I
                                                    found talk about
                                                    this space being for
                                                    holding survivors
                                                    (i.e. evac
                                                    failure/to-space
                                                    exhaustion
                                                    mitigation).  It
                                                    sounds like you're
                                                    saying these
                                                    reserved regions
                                                    should also be used
                                                    to satisfy HO
                                                    allocs? </div>
                                                  <div><br>
                                                  </div>
                                                  <div>Thanks</div>
                                                </div>
                                              </div>
                                            </div>
                                          </div>
                                        </div>
                                        <span
                                          class="m_1270621050554131485gmail-">
                                          ______________________________<wbr>_________________<br>
                                          hotspot-gc-use mailing list<br>
                                          <a moz-do-not-send="true"
                                            href="mailto:hotspot-gc-use@openjdk.java.net"
                                            target="_blank">hotspot-gc-use@openjdk.java.ne<wbr>t</a><br>
                                          <a moz-do-not-send="true"
                                            href="http://mail.openjdk.java.net/mailman/listinfo/hotspot-gc-use"
                                            target="_blank">http://mail.openjdk.java.net/m<wbr>ailman/listinfo/hotspot-gc-use</a><br>
                                        </span></div>
                                    </blockquote>
                                  </div>
                                  <br>
                                </div>
                              </div>
                            </blockquote>
                          </div>
                          <br>
                        </div>
                      </div>
                    </blockquote>
                    <br>
                  </div>
                </div>
              </div>
            </blockquote>
          </div>
          <br>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>