On Wed, 1 Sep 2021 11:32:15 GMT, Coleen Phillimore <cole...@openjdk.org> wrote:

>> src/hotspot/share/memory/heapInspection.cpp line 564:
>> 
>>> 562:   missed_count = ric.missed_count();
>>> 563:   {
>>> 564:     MutexLocker x(&_mutex, Mutex::_no_safepoint_check_flag);
>> 
>> This change seems unnecessary - this lock is only taken by GC threads, or 
>> the VMThread (?), never a JavaThread, but this change makes it look like it 
>> is taken by a JavaThread that wants to avoid safepoint checks.
>
> This change is necessary in that we have a check inside Mutex::lock that this 
> flag matches how the lock was defined.  It was argued that we want to have to 
> pass this parameter to know when safepoints are not checked in the code that 
> was taking out the lock, so the parameter is needed.

I hadn't realized that we included a check for safepoint-check-never for the 
NJT case. I thought the safepoint-check state was completely ignored for NJTs.

I don't recall if in the past I agreed with doing this, but I think it is 
confusing and misleading to see this in the code. But so be it, as far as this 
PR goes at least.

Thanks.

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

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

Reply via email to