RFR: 8337217: Port VirtualMemoryTracker to use VMATree

Johan Sjölen jsjolen at openjdk.org
Fri Nov 8 10:52:06 UTC 2024


On Fri, 9 Aug 2024 10:14:10 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

>> - `VMATree` is used instead of `SortedLinkList` in new class `VirtualMemoryTrackerWithTree`.
>>  -  A wrapper/helper `RegionTree` is made around VMATree to make some calls easier.
>>  -  Both old and new versions exist in the code and can be selected via `MemTracker::set_version()`
>>  - `find_reserved_region()` is used in 4 cases, it will be removed in further PRs.
>>  - All tier1 tests pass except one ~that expects a 50% increase in committed memory but it does not happen~  https://bugs.openjdk.org/browse/JDK-8335167.
>>  - Adding a runtime flag for selecting the old or new version can be added later.
>>  - Some performance tests are added for new version, VMATree and Treap, to show the idea and should be improved later. Based on the results of comparing speed of VMATree and VMT, VMATree shows ~40x faster response time.
>
> src/hotspot/share/nmt/regionsTree.hpp line 46:
> 
>> 44:   using Node = VMATree::TreapNode;
>> 45: 
>> 46:   class NodeHelper : public Node {
> 
> This shouldn't inherit from `Node` and then have each instance be cast into `NodeHelper`. Make into `class Utils : public AllStatic`.

Alternatively create it by composition:

```c++
class NodeHelper {
  Node& node;
  NodeHelper(Node* node) : node(*node) {}
  // All of the methods
};

{ // Some Node* node
  NodeHelper nh(node);
  // Use nh 
}

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20425#discussion_r1711643629


More information about the core-libs-dev mailing list