RFR: 8304824: NMT should not use ThreadCritical [v5]
Robert Toyonaga
duke at openjdk.org
Fri Sep 20 18:11:53 UTC 2024
On Tue, 17 Sep 2024 23:16:47 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> Robert Toyonaga has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains five commits:
>>
>> - Merge master
>> - replace tty in pd_release_memory while holding NMT lock.
>> - Switch to using a Hotspot Mutex.
>> - Comments. Hide assertion behind DEBUG. Replace MemoryFileTracker locker. make reentrant.
>> - Replace ThreadCritical with a specific NMT lock
>
> src/hotspot/os/windows/os_windows.cpp line 3785:
>
>> 3783: log_warning(os)("bad release: [" PTR_FORMAT "-" PTR_FORMAT "): %s", p2i(start), p2i(end), err);
>> 3784: #ifdef ASSERT
>> 3785: fileStream fs(stderr);
>
> tty generally prints to stdout, but now this prints to stderr. I guess it doesn't really matter as we are about to crash anyway.
Ok I've switched it to stdout
> src/hotspot/share/runtime/mutexLocker.hpp line 197:
>
>> 195: _mutex(mutex) {
>> 196: bool no_safepoint_check = flag == Mutex::_no_safepoint_check_flag;
>> 197: if (_mutex != nullptr && Thread::current_or_null() != nullptr) {
>
> I do not like this addition to the mutex locker code. First, it probably needs to be `Thread::current_or_null_safe` in case we ever lock in a signal-handling context. But second this slows down all mutex uses. Instead `NMTLocker` should extend ConditionalMutexLocker and make the current thread check the condition.
Ok I've taken those checks out of `MutexLockerImpl` and applied your suggestion.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20852#discussion_r1769006796
PR Review Comment: https://git.openjdk.org/jdk/pull/20852#discussion_r1769008575
More information about the serviceability-dev
mailing list