RFR: Add NMT support for Java heap

Per Liden per.liden at oracle.com
Tue Dec 12 11:20:26 UTC 2017

On 2017-12-12 11:50, Aleksey Shipilev wrote:
> On 12/12/2017 11:42 AM, Per Liden wrote:
>> As Aleksey noticed, we don't register the Java heap with the native memory tracker. Here's a patch
>> to do that.
>> http://cr.openjdk.java.net/~pliden/zgc/nmt_java_heap/webrev.0/
> Patch looks good, but the NMT "reserved" data is off the charts:
> Total: reserved=17180280855KB, committed=17143487KB
> -                 Java Heap (reserved=17179869184KB, committed=16777216KB)
>                             (mmap: reserved=17179869184KB, committed=16777216KB)
> I guess this should not pass ZAddressSpaceSize, and instead tell the reserved space of the first
> mapping?
> +  // Register address space with native memory tracker
> +  nmt_reserve(ZAddressSpaceStart, ZAddressSpaceSize);

I think this is correct actually. But it depends on how one views things 
I guess. As I see it, I want to be able to look in /proc/../maps and 
with NMT see what the different mappings correlate to. If we only 
registered the first heap view, then there would be a big mysterious 
reservation that would go unaccounted. That doesn't sound right to me, 
but I'm open for hearing other opinions on this. The big number there 
covers all addresses for all heap views/mappings (i.e. the actual 
address space that is reserved). It should be noted that, in ZGC, the 
heap address space doesn't have a 1:1 relation with max heap size.


> Thanks,
> -Aleksey

More information about the zgc-dev mailing list