RFR: JDK-8314654: Metaspace: move locking out of MetaspaceArena [v2]

Johan Sjölen jsjolen at openjdk.org
Mon Sep 4 10:20:43 UTC 2023


On Tue, 29 Aug 2023 13:24:37 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> We have the following relationships.
>> 
>> 
>> 
>> -->  CLD  --> ClassLoaderMetaspace  ----+---> MetaspaceArena (nonclass)
>>                                         |
>>                                         |                                                                
>>                                         +---> MetaspaceArena (class)
>> 
>> 
>> 
>> For historical reasons, `MetaspaceArena` locks itself with a lock owned by `ClassLoaderData` on all public entry points. That is unnecessarily complex. The natural point for this locking would be in the `ClassLoaderMetaspace` class.
>> 
>> Moving locking up one layer reduces complexity and prepares for some upcoming Metaspace changes for Liliput.
>> 
>> Note: Nothing functional changes. We lock the same paths as before, only where we used to lock upon entry in MA, we now lock in the caller.
>> 
>> In gtests, however, I got rid entirely of locking since all those tests are single-threaded, and the implicit locking done by MA had been just unnecessary.
>
> Thomas Stuefe has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
> 
>  - feedback Andrew
>  - Merge branch 'master' into metaspace-preps
>  - move lock out of arena
>  - reduce header changes in maArena.hpp

LGTM,

Thanks for this.

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

Marked as reviewed by jsjolen (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/15447#pullrequestreview-1609226563


More information about the hotspot-runtime-dev mailing list