RFR: 8267653: Remove Mutex::_safepoint_check_sometimes [v2]

David Holmes david.holmes at oracle.com
Wed May 26 02:00:08 UTC 2021


On 26/05/2021 11:53 am, Coleen Phillimore wrote:
> On Wed, 26 May 2021 00:38:00 GMT, David Holmes <dholmes at openjdk.org> wrote:
> 
>>> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>>>
>>>    Add assert that the thread is terminated before taking Heap_lock
>>
>> src/hotspot/share/gc/shenandoah/shenandoahReferenceProcessor.cpp line 543:
>>
>>> 541:   } else {
>>> 542:     // Heap_lock protects external pending list
>>> 543:     MonitorLocker ml(Heap_lock);
>>
>> For performance you could leave the _no_safepoint_check flag.
> 
> I cannot leave it because there's an assert to verify that we don't try to take this lock without a safepoint check, since it was declared with safepoint_check_always.

But that assert only applies to JavaThreads and this is being taken by a 
GC thread isn't it?

>> src/hotspot/share/runtime/thread.cpp line 3420:
>>
>>> 3418:     // we'll never emerge out of the safepoint before the VM exits.
>>> 3419:
>>> 3420:     MutexLocker ml(Heap_lock);
>>
>> Can you add an assert before this that the thread is_terminated() as that is the key to the mutex acquisition not doing a safepoint check.
> 
> Ok, I can add:
> +    assert(thread->is_terminated(), "must be terminated before acquiring Heap_lock");
> and rerun tests.

Thanks,
David

> -------------
> 
> PR: https://git.openjdk.java.net/jdk/pull/4184
> 


More information about the shenandoah-dev mailing list