JDK-8252132 : Investigate MetaspaceArena locking after JEP387
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 16
  • Priority: P4
  • Status: Resolved
  • Resolution: Won't Fix
  • Submitted: 2020-08-21
  • Updated: 2021-07-09
  • Resolved: 2021-07-09
Related Reports
Relates :  
A metaspace arena (called SpaceManager before JEP387) has a reference to an outside-provided lock which resides in the owning CLD (_metaspace_lock). It locks itself using this lock.

This seems an unusual pattern and causes code to be more complicated than needed. E.g. it causes the existence of the MetaspaceTestArena class whose only purpose is to bundle a lock with an arena.

Investigate whether it would be better to either
- let the arena be oblivious to any locking and make it the responsibility of the caller to lock
- let the arena own its own lock.

Both solutions are viable, but should be investigated only after the brunt of the JEP387 changes hits mainline.
I lack the time to do this right now. Let's close it for now; can be reopened if needed.