RFR: JDK-8314654: Metaspace: move locking out of MetaspaceArena

Thomas Stuefe stuefe at openjdk.org
Tue Aug 29 07:49:25 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.

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

Commit messages:
 - move lock out of arena
 - reduce header changes in maArena.hpp

Changes: https://git.openjdk.org/jdk/pull/15447/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15447&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8314654
  Stats: 109 lines in 6 files changed: 19 ins; 75 del; 15 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