RFR: 8277990: NMT: Remove NMT shutdown capability

Thomas Stuefe stuefe at openjdk.java.net
Thu Dec 2 16:26:25 UTC 2021


On Wed, 1 Dec 2021 16:00:09 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:

> NMT shutdown functionality is a remnant of its first implementation, which could consume excessive amount of memory, therefore, it needed capability to shut it self down to ensure health of JVM. This is no longer a case for current implementation.
> 
> After JDK-8277946, there is no longer a use, so it can be removed.
> 
> Test:
> - [x] hotspot_nmt
> - [x] tier1 with NMT on

Nice cleanup.

You missed a few:
- test/lib/jdk/test/whitebox/WhiteBox.java, `NMTChangeTrackingLevel`
- test/lib/sun/hotspot/WhiteBox.java, same

Will the removal of WB functions cause incompatibilities with older versions of jtreg (can't imagine it does, just wondering)?

Cheers, Thomas

src/hotspot/os/posix/perfMemory_posix.cpp line 1031:

> 1029: static void unmap_shared(char* addr, size_t bytes) {
> 1030:   int res;
> 1031:   if (MemTracker::tracking_level() >= NMT_summary) {

Just an idle thought, maybe we could add a `MemTracker::is_enabled()` as a shortcut for level > off.

src/hotspot/share/services/nmtCommon.hpp line 46:

> 44: // "summary": after initialization with NativeMemoryTracking=summary - NMT in summary mode
> 45: //             - category summaries per tag are tracked
> 46: //             - thread stacks are tracked

Unrelated to your patch, while looking at this I notice that my old comment about "summary" was wrong: with "summary", the malloc site table is not allocated and does not get used. Since you are here, could you fix the comment? Thanks!

src/hotspot/share/services/nmtCommon.hpp line 67:

> 65:   NMT_off,
> 66:   NMT_summary,
> 67:   NMT_detail

I'm fine with removing the explicit numbers here, but could you please add

STATIC_ASSERT(off > unknown)
STATIC_ASSERT(summary > off)
STATIC_ASSERT(detail > summary)

somewhere? (Maybe in the cpp file, its not such an eyesore there).

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

Changes requested by stuefe (Reviewer).

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


More information about the hotspot-dev mailing list