RFR: 8328944: NMT reports "unknown" memory

Gerard Ziemski gziemski at openjdk.org
Sat Nov 16 03:29:30 UTC 2024


On Mon, 4 Nov 2024 08:28:29 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> We use mtNone value in several functions default parameters, which may show up in NMT reports.
>> 
>> We address this, by removing the default value and forcing, where possible, for the callers to declare NMT tag that reflects the usage.
>> 
>> Eventually the goal would be not to use mtNone anywhere, but we are not there quite yet.
>> 
>> TODO: update copyrights.
>> 
>> Testing: undergoing MARCH5 tier1-5 ...
>
> src/hotspot/share/nmt/virtualMemoryTracker.cpp line 364:
> 
>> 362:       // thread does not detach from VM before exits, and leads to
>> 363:       // leak JavaThread object
>> 364:       if ((reserved_rgn->mem_tag() == mtThreadStack) && (reserved_rgn->mem_tag() == mem_tag)) {
> 
> Please explain the changes in this function, especially the changed conditions. The added conditions for tag equality seem wrong to me.

Sorry, I think this was just a debugging code that I left it by mistake - I was testing whether we can tighten up the logic of when we allow the tags to be allowed to change, but this looks indeed wrong, since nothing would change.

Reverted.

> src/hotspot/share/runtime/safepointMechanism.cpp line 61:
> 
>> 59:     const size_t page_size = os::vm_page_size();
>> 60:     const size_t allocation_size = 2 * page_size;
>> 61:     char* polling_page = os::reserve_memory(allocation_size, false, mtSafepoint);
> 
> remove registration

Fixed.

> src/hotspot/share/utilities/debug.cpp line 712:
> 
>> 710: 
>> 711: void initialize_assert_poison() {
>> 712:   char* page = os::reserve_memory(os::vm_page_size(), false, mtInternal);
> 
> remove registration

Fixed.

> test/hotspot/jtreg/runtime/NMT/MallocRoundingReportTest.java line 60:
> 
>> 58:                 NMTTestUtils.runJcmdSummaryReportAndCheckOutput(
>> 59:                         "Test (reserved=" + numKB + "KB, committed=" + numKB + "KB)",
>> 60:                         "(malloc=" + numKB + "KB type=12 #1) (at peak)"
> 
> Again, this is wrong. The memory had not been reserved for NMT usage, so it should not be tagged with mtNMT (12)

Looking into it...

> test/hotspot/jtreg/runtime/NMT/MallocRoundingReportTest.java line 68:
> 
>> 66:                 NMTTestUtils.runJcmdSummaryReportAndCheckOutput(
>> 67:                         "Test (reserved=0KB, committed=0KB)",
>> 68:                         "(malloc=0KB type=12) (peak=" + numKB + "KB #1)"
> 
> ditto

Looking into it...

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21843#discussion_r1844890480
PR Review Comment: https://git.openjdk.org/jdk/pull/21843#discussion_r1844890575
PR Review Comment: https://git.openjdk.org/jdk/pull/21843#discussion_r1844890617
PR Review Comment: https://git.openjdk.org/jdk/pull/21843#discussion_r1844890676
PR Review Comment: https://git.openjdk.org/jdk/pull/21843#discussion_r1844890710


More information about the shenandoah-dev mailing list