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

Thomas Stuefe stuefe at openjdk.org
Wed Oct 4 08:34:18 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 five additional commits since the last revision:

 - Merge branch 'openjdk:master' into metaspace-preps
 - 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/4cadb4ae..b9835985

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

  Stats: 121239 lines in 3364 files changed: 53259 ins; 26183 del; 41797 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