RFR: 8304824: NMT should not use ThreadCritical [v7]

David Holmes dholmes at openjdk.org
Wed Oct 2 02:37:41 UTC 2024


On Thu, 26 Sep 2024 12:29:14 GMT, Robert Toyonaga <duke at openjdk.org> wrote:

>> ### Summary
>> This PR just replaces `ThreadCritical` with a lock specific to NMT.  `ThreadCritical` is a big lock and is unnecessary for the purposes of NMT. I've implemented the new lock with a semaphore so that it can be used early before VM init.  There is also the possibility of adding assertions in places we expect NMT to have synchronization. I haven't added assertions yet in many places because some code paths such as the (NMT tests)  don't lock yet. I think it makes sense to close any gaps in locking in another PR in which I can also add more assertions. 
>> 
>> Testing:
>> - hotspot_nmt
>> - gtest:VirtualSpace
>> - tier1
>
> Robert Toyonaga has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Rename lock and mutex locker. Add back ThreadCritical when protecting mtChunk.

Okay I am happy with this now. Thanks.

If I heard correctly Thomas is on vacation this month so you may need to proceed with a different second review and follow up when he gets back if there are any problems. I will be on vacation after Friday for 10 days.

src/hotspot/share/utilities/vmError.cpp line 723:

> 721:     // Avoid reentrancy due to mallocs in detailed mode.
> 722:     MemTracker::reduce_tracking_to_summary();
> 723:     // Manually unlock if already holding lock when upon entering error reporting.

Suggestion:

    // Manually unlock if already holding lock upon entering error reporting.

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

Marked as reviewed by dholmes (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/20852#pullrequestreview-2341807048
PR Review Comment: https://git.openjdk.org/jdk/pull/20852#discussion_r1783770844


More information about the serviceability-dev mailing list