RFC: Piggy-back monitor-deflation and nmethod-marking on GC

David Holmes david.holmes at oracle.com
Mon Sep 17 03:52:29 UTC 2018

Hi Roman,

On 14/09/2018 5:36 PM, Roman Kennke wrote:
> Regarding those issues:
> https://bugs.openjdk.java.net/browse/JDK-8132849
> https://bugs.openjdk.java.net/browse/JDK-8132849
> I.e. increased pause times caused by monitor-deflation and
> nmethod-marking, there has been the suggestion by the reporter to
> piggy-back those activities on GC thread-scanning.
> We do have code in Shenandoah that does this since quite a while.
> The idea is to introduce two new methods in VM_Operation:
>    virtual bool deflates_idle_monitors();
>    virtual bool marks_nmethods();
> That basically tell the runtime whether or not a particular VM_Operation
> (e.g. InitMark) can take over any of the two activties, and if so, skip
> the corresponding activity in the preceding SP-cleanup phase. This means
> that the VM_Operation needs to handle this itself. The change also
> includes some changes in sychronizer, thread etc to make this relatively
> easy to implement from a GC standpoint.

So the VM_op hands off these tasks to GC threads?

This seems a bit "klunky" to me. What you're basically achieving is 
concurrent cleanup whilst still at a safepoint, but this really has 
nothing to do with GC - you're just "hijacking" the GC threads because 
it is convenient.

I'd rather see a more concerted effort to avoid having a monitor 
deflation problem in the first place - as per my comment in JDK-8153224. 
That is a slightly different, but related, goal to the JEP.


> Question: would there be interest in getting this upstreamed? If so, I
> would put together a patch for reviewing.
> Alternatively or additionally, at least for monitor deflation, there is
> the JEP Draft: Concurrent Monitor Deflation:
> https://bugs.openjdk.java.net/browse/JDK-8183909
> But this seems like a very serious amount of work.
> Roman

More information about the hotspot-gc-dev mailing list