RFR: 8328944: NMT reports "unknown" memory [v2]

Stefan Karlsson stefank at openjdk.org
Wed Nov 20 15:38:24 UTC 2024


On Tue, 19 Nov 2024 22:01:13 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:

>> We use `mtNone` value in several functions default parameters, which may show up in NMT reports.
>> 
>> We address this, by avoiding using `mtNone`.
>> 
>> This fix only addresses the cases covered by the issue. I am not trying to replace every single `mtNone` here, but eventually the goal would be to do just that.
>> 
>> TODO: update copyrights.
>> 
>> Testing: undergoing MARCH5 tier1-5 ...
>
> Gerard Ziemski has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision:
> 
>  - avoid using mtNone
>  - Merge remote-tracking branch 'upstream/master' into JDK-8328944
>  - revert, we will re-do with a smaller change
>  - remove more mtNone
>  - remove API that allows to change the mem_tag for virtual memory, feedback
>  - do not allow default parameter for mtNone

src/hotspot/os/linux/os_linux.cpp line 4587:

> 4585:   char* hint = (char*)(os::Linux::initial_thread_stack_bottom() -
> 4586:                        (StackOverflow::stack_guard_zone_size() + page_size));
> 4587:   char* codebuf = os::attempt_reserve_memory_at(hint, page_size, false, mtInternal);

Could this be mtThread instead?

src/hotspot/os/linux/os_linux.cpp line 4595:

> 4593:     // map our codebuf, try again at an address one megabyte lower.
> 4594:     hint -= 1 * M;
> 4595:     codebuf = os::attempt_reserve_memory_at(hint, page_size, false, mtInternal);

Could this be mtThread instead?

src/hotspot/share/memory/virtualspace.hpp line 74:

> 72:   // Initialize the reserved space with the given size. Depending on the size
> 73:   // a suitable page size and alignment will be used.
> 74:   explicit ReservedSpace(size_t size, MemTag mem_tag);

Suggestion:

  ReservedSpace(size_t size, MemTag mem_tag);

No need for `explicit` when you've added a parameter.

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);

Suggestion:

    char* polling_page = os::reserve_memory(allocation_size, !ExecMem, mtSafepoint);

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);

Suggestion:

  char* page = os::reserve_memory(os::vm_page_size(), !ExecMem, mtTest);

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21843#discussion_r1850535276
PR Review Comment: https://git.openjdk.org/jdk/pull/21843#discussion_r1850535378
PR Review Comment: https://git.openjdk.org/jdk/pull/21843#discussion_r1850543822
PR Review Comment: https://git.openjdk.org/jdk/pull/21843#discussion_r1850541711
PR Review Comment: https://git.openjdk.org/jdk/pull/21843#discussion_r1850541996


More information about the shenandoah-dev mailing list