CMS parallel initial mark; vm thread sneaking in Thread::try_lock()

Jon Masamitsu jon.masamitsu at
Tue Jun 11 15:30:29 PDT 2013

On 6/10/13 12:49 PM, Thomas Schatzl wrote:
> Hi,
> On Fri, 2013-06-07 at 11:28 -0700, Jon Masamitsu wrote:
>> On 6/7/2013 4:23 AM, Thomas Schatzl wrote:
>>> - the code to get the lock on _eden_chunk_sampling_active seems to be
>>> needlessly complicated.
>>> Please consider using a dedicated Monitor in conjunction with
>>> try_lock(). I.e.
>> Thomas,
>> Any concerns about the "sneak" code in try_lock()?  That would only
>> matter if the VM thread were involved in the eden sampling along with
>> other GC threads, yes?
> I do not think so in this case. Only the VM thread can sneak, and only
> during safepoint. The sampling is done only for eden space and eventually
> from-space, which are never allocated to during gc (only by java threads
> outside of stw pauses), aren't they?
> The code could assert that in the sampling too.
Where would the assert go that asserts sampling is
being done?

Or do you mean at the use of try_lock() assert that
we're not the VM thread?

> Even then, this sampling is only active for defnew at the moment. The
> only thread that is active in a defnew collection is the vm thread where
> sneaking cannot happen.
> Thomas

More information about the hotspot-runtime-dev mailing list