Questions on concurrent class unloading

Zhengyu Gu zgu at redhat.com
Mon Apr 8 20:10:14 UTC 2019



On 4/8/19 3:28 PM, Erik Österlund wrote:
> Hi Zhengyu,
> 
> On 2019-04-08 21:02, Zhengyu Gu wrote:
>>
>>
>> On 4/8/19 2:49 PM, Erik Osterlund wrote:
>>> Hi Zhengyu,
>>>
>>> The code is called by concurrent GC threads, so 
>>> is_ConcurrentGC_thread() should return true.
>>>
>> E.g ZNMethodUnlinkClosure is only used by ZNMethodUnlinkTask, and the 
>> task is executed by worker threads, which are not concurrent gc 
>> thread. No?
> 
> The workgang we use for concurrent execution, uses concurrent GC threads.

Got it.

Thanks,

-Zhengyu

> 
>> I also added assert(false, "debug") inside under nm->is_unloading() 
>> branch, it never fired.
> 
> So... are you running a workload that needs to unload nmethods? Because 
> we are definitely unloading nmethods. I did the same experiment, and hit 
> the assert as expected.
> 
> /Erik
> 
>> Thanks,
>>
>> -Zhengyu
>>
>>
>>
>>> is_unloading() returns true if the nmethod has a dead oop due to GC.
>>>
>>> /Erik
>>>
>>>> On 8 Apr 2019, at 17:27, Zhengyu Gu <zgu at redhat.com> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I am studying concurrent class unloading in ZGC, it looks to me that 
>>>> nothing gets unlinked (ZNMethod::unlink())and purged 
>>>> (ZNMethod::purge()).
>>>>
>>>> Inside ZNMethodUnlinkClosure::do_nmethod() [1]
>>>>
>>>> It appears that nm->is_unloading() can never be true. Otherwise, 
>>>> assertion should fail inside nm->flush_dependencies(false), cause 
>>>> neither Universe::heap()->is_gc_active() (true for STW GC) nor 
>>>> is_ConcurrentGC_thread() is true.
>>>>
>>>> Similar with ZNMethodPurgeClosure [2] , nm->make_unloaded() has 
>>>> similar assertion.
>>>>
>>>> What did I miss?
>>>>
>>>> Thanks,
>>>>
>>>> -Zhengyu
>>>>
>>>>
>>>> [1] 
>>>> http://hg.openjdk.java.net/jdk/jdk/file/542735f2a53e/src/hotspot/share/gc/z/zNMethod.cpp#l279 
>>>>
>>>>
>>>> [2] 
>>>> http://hg.openjdk.java.net/jdk/jdk/file/542735f2a53e/src/hotspot/share/gc/z/zNMethod.cpp#l357 
>>>>
>>>>
>>>>
>>>>
>>>


More information about the zgc-dev mailing list