<div dir="ltr">Hi Stefan<div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 11, 2017 at 2:43 PM, Stefan Johansson <span dir="ltr"><<a href="mailto:stefan.johansson@oracle.com" target="_blank">stefan.johansson@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 text="#000000" bgcolor="#FFFFFF">
    <tt>Hi Thomas,</tt><span class=""><br>
    <br>
    <div class="m_-4568199977031761021moz-cite-prefix">On 2017-10-11 14:16, Thomas Stüfe
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">Hi Stefan,
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On Wed, Oct 11, 2017 at 1:52 PM,
            Stefan Johansson <span dir="ltr"><<a href="mailto:stefan.johansson@oracle.com" target="_blank">stefan.johansson@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">Hi Thomas,<br>
              <br>
              Seems like you found a bug here. As you say, for G1 the
              "commit watermark" doesn't really make sense, because we
              can have regions uncommitted in the middle of the heap. I
              think we print the value to look similar to the other
              heaps/GCs. The bug here is that we don't multiply with the
              region size, but just add it. So we should change the row
              in question to:<br>
                p2i(_hrm.reserved().start() + (_hrm.length() *
              HeapRegion::GrainWords)),<br>
              <br>
              This would give a better value. It would not be the whole
              truth, since there might still be objects above this
              address if we have uncommitted regions in the heap. I
              better value might be "highest region committed" * "heap
              region size", but that would lie because not all memory
              below that has to be committed.<br>
              <br>
              I created a bug for this:<br>
              <a href="https://bugs.openjdk.java.net/browse/JDK-8189169" rel="noreferrer" target="_blank">https://bugs.openjdk.java.net/<wbr>browse/JDK-8189169</a><br>
              <br>
            </blockquote>
            <div><br>
            </div>
            <div>Thank you for taking a look.</div>
            <div><br>
            </div>
            <div>Would it not make more sense to just omit the middle
              address value then for g1? <br>
            </div>
          </div>
        </div>
      </div>
    </blockquote></span>
    Yes, that might actually make most sense. <br><span class="">
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div><br>
            </div>
            <div>If I understand HeapRegionManager::commit_<wbr>regions() /
              uncommit_regions() correctly, comitted and uncomitted
              regions can freely interleave, and _hrm.length() is just a
              counter, not an address range. So we would print a
              theoretical address value - the end of the committed
              memory if all regions were located consecutively. But how
              useful could that be? </div>
            <div><br>
            </div>
            <div>When I look at the commit boundary value in hs-err
              files, I usually do this to check if a heap pointer points
              into valid memory or into uncomitted memory. For that, I
              would prefer the value to be exact or not be there.</div>
            <div><br>
            </div>
          </div>
        </div>
      </div>
    </blockquote></span>
    I agree, this was the part about "not the whole truth". And I agree
    with you, the best way is probably to just remove it. I never use
    this value for G1, I always look at the region table to check if
    pointers are valid or not.<br>
    <br></div></blockquote><div><br></div><div>Good Point, there is that. Thank you!</div><div>..Thomas</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF">
    Thanks,<br>
    Stefan<span class=""><br>
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div>Thanks, Thomas</div>
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
              Cheers,<br>
              Stefan
              <div class="m_-4568199977031761021gmail-HOEnZb">
                <div class="m_-4568199977031761021gmail-h5"><br>
                  <br>
                  <br>
                  On 2017-10-11 12:48, Thomas Stüfe wrote:<br>
                  <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
                    Hi all,<br>
                    <br>
                    In a customer error file I found the following
                    output:<br>
                    <br>
                    Heap:<br>
                     garbage-first heap   total 2592768K, used 1914672K
                    [0x0000000679000000, 0x0000000679104f20,
                    0x00000007f0000000).<br>
                    <br>
                    I wonder about the middle address value
                    (0x0000000679104f20). I was assuming this to be the
                    commit watermark. But the value seemed awfully low -
                    just ~1MB beyond the start address of the reserved
                    area. Given that about 4/5th of the heap is in-use,
                    this seemed odd.<br>
                    <br>
                    Looking at the code:<br>
                    <br>
                    void G1CollectedHeap::print_on(outp<wbr>utStream*
                    st) const {<br>
                    ....<br>
                      st->print(" [" PTR_FORMAT ", " PTR_FORMAT ", "
                    PTR_FORMAT ")",<br>
                                p2i(_hrm.reserved().start()),<br>
                            >>    p2i(_hrm.reserved().start() +
                    _hrm.length() + HeapRegion::GrainWords), <<<br>
                                p2i(_hrm.reserved().end()));<br>
                    ...<br>
                    }<br>
                    <br>
                    I am still confused. What is
                    "_hrm.reserved().start() + _hrm.length() +
                    HeapRegion::GrainWords"?  We add the number of
                    comitted heap regions to the start address, plus the
                    size of one heap region in words? Sorry, I am not a
                    GC expert, could someone clarify what this address
                    is?<br>
                    <br>
                    Another question, while looking further into how g1
                    commits memory I looked at G1PageBasedVirtualSpace
                    and it seems to me that there is no clear commit
                    water mark because pages do not have to be committed
                    sequentially, is that correct?<br>
                    <br>
                    Thanks for clarifying!<br>
                    <br>
                    Kind Regards, Thomas<br>
                  </blockquote>
                  <br>
                </div>
              </div>
            </blockquote>
          </div>
          <br>
        </div>
      </div>
    </blockquote>
    <br>
  </span></div>

</blockquote></div><br></div></div>