RFR: JDK-8296764 NMT: reduce loads in os::malloc [v2]

Thomas Stuefe stuefe at openjdk.org
Fri Nov 11 06:10:20 UTC 2022


> We read the NMT level at every ps::malloc/realloc/free etc, even if NMT is off. That is unavoidable. But we also read a second variable that shadows the NMT level `_nmt_was_initialized`. That state is synonymous with NMT level "unknown," so there is no need for this second load.
> 
> Furthermore, NMT level is volatile. That had been necessary in older times since we used to shut down NMT on resource exhaustion. But since [JDK-8256844](https://bugs.openjdk.org/browse/JDK-8256844), NMT level is fixed at initialization, so we can remove the volatile specifier.
> 
> Patch 
> - removes `_nmt_was_initialized` and redirects it to `MemTracker::is_initialized()`, which gets inlined to a load of NMT level. 
> - makes NMT level non-volatile
> - removes _is_nmt_env_valid, which had been dead code

Thomas Stuefe has updated the pull request incrementally with one additional commit since the last revision:

  Feedback andrew, ioi

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/11080/files
  - new: https://git.openjdk.org/jdk/pull/11080/files/9d5cac2c..228bf3cb

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

  Stats: 4 lines in 3 files changed: 0 ins; 0 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/11080.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11080/head:pull/11080

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


More information about the hotspot-runtime-dev mailing list