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

Thomas Stuefe stuefe at openjdk.org
Tue Aug 29 13:24:37 UTC 2023


> 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

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/15447/files
  - new: https://git.openjdk.org/jdk/pull/15447/files/29cbe4a3..4cadb4ae

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=15447&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=15447&range=00-01

  Stats: 5319 lines in 87 files changed: 4031 ins; 393 del; 895 mod
  Patch: https://git.openjdk.org/jdk/pull/15447.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15447/head:pull/15447

PR: https://git.openjdk.org/jdk/pull/15447


More information about the hotspot-runtime-dev mailing list