RFR: JDK-8262165: NMT report should state how many callsites had been skipped

Aleksey Shipilev shade at openjdk.java.net
Fri Apr 16 08:01:38 UTC 2021


On Tue, 23 Feb 2021 07:12:10 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

> (This is a breakout from JDK-8261238, which seems to be stuck in review (https://github.com/openjdk/jdk/pull/2428). I factor out the display changes, which hopefully are non-controversial enough to get upstream easily.)
> 
> NMT silently omits call sites in its report whose allocation rate is too small to get over certain, hidden, thresholds:
> a) there is a hard wired threshold of 1K in the baseline collector
> b) we also skip all sites whose size is less than what the unit is (eg scale=G, we skip all allocations < 1G
> 
> NMT report should state how many call sites had been omitted.
> 
> ----
> 
> The patch adds a counter in the NMT reporter to count omitted call sites, then prints that counter out. 
> 
> In base report, just a generic message is shown to notify the user that categories > scale are ignored:
> 
> 
> thomas at mainframe$ jcmd Interl VM.native_memory scale=m
> 2847:
> 
> Native Memory Tracking:
> 
> (Omitting categories weighting less than 1MB)
> 
> Total: reserved=5540MB, committed=147MB
> -                 Java Heap (reserved=3996MB, committed=34MB)
>                             (mmap: reserved=3996MB, committed=34MB) 
> <skip>
> 
> 
> In detail report, the total count of omitted call sites is displayed at the bottom:
> 
> 
> thomas at mainframe$ jcmd Interl VM.native_memory scale=m detail
> 2847:
> 
> <skip>
> 
> [0x00007f4e062e3e6b] os::reserve_memory(unsigned long, bool, MEMFLAGS)+0x16b
> [0x00007f4e05ac4f47] MmapArrayAllocator<unsigned char>::allocate(unsigned long, MEMFLAGS)+0x127
> [0x00007f4e05ac4cb2] G1FromCardCache::initialize(unsigned int)+0xe2
> [0x00007f4e05a863f1] G1CollectedHeap::initialize()+0x3c1
>                              (reserved=1MB, committed=1MB Type=GC)
> 
> (183 call sites weighting less than 1MB each omitted.)
> 
> 
> 
> Note: this patch only takes care of the sites omitted due to the scale threshold (b). It does not count how many sites had been omitted due to the baseline threshold (a). Since I still hope to remove that threshold completely with JDK-8261238, I did not put any work toward modifying the output here.
> 
> ----
> 
> Tests: I manually ran runtime/NMT tests.

Pretty simple, sure. Only minor nits.

src/hotspot/share/services/memReporter.cpp line 307:

> 305:     // Don't report if site has reserved less than one unit of whatever our scale is
> 306:     if (scale() > 1 && amount_in_current_scale(virtual_memory_site->reserved()) == 0) {
> 307:       num_omitted ++;

I think the Hotspot style is to say `num_omitted++`.

src/hotspot/share/services/memReporter.hpp line 150:

> 148:   // Report virtual memory map
> 149:   void report_virtual_memory_map();
> 150:   // Report malloc allocation sites; returns number of omitted sites.

Here and two lines below, comments do not need trailing points.

-------------

Marked as reviewed by shade (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/2687


More information about the hotspot-runtime-dev mailing list