RFR: JDK-8326586: Improve Speed of System.map

Johan Sjölen jsjolen at openjdk.org
Mon Feb 26 07:59:55 UTC 2024


On Fri, 23 Feb 2024 15:31:27 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

> A small optimization that speeds up `jcmd pid System.map` by orders of magnitude by optimizing NMT cache lookup for sequential accesses. This cache is used to map NMT against System information - and the latter usually comes in sequential form, e.g. scanned from `/proc/<pid>/maps` or via VirtualQuery.
> 
> On Linux x64, `System.map`for a JVM with an artificially bloated process space (1 million mappings) takes:
> 
> before this patch: 6.3 minutes
> with this patch: 4.2 seconds
> 
> which is a 87x speed improvement.
> 
> Ping @jdksjolen and @gerard-ziemski?

Approved, with a question.

src/hotspot/share/nmt/memMapPrinter.cpp line 134:

> 132:     // of OS mappings is scanned (VirtualQuery, /proc/pid/maps), and these lists
> 133:     // are usually sorted in order of addresses, ascending.
> 134:     static uintx last = 0;

Sorry, I should've caught this when we first reviewed this, but why are we using `uintx` instead of `uintptr_t`?

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

Marked as reviewed by jsjolen (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/17984#pullrequestreview-1900154319
PR Review Comment: https://git.openjdk.org/jdk/pull/17984#discussion_r1502168358


More information about the hotspot-runtime-dev mailing list