RFR: JDK-8326586: Improve Speed of System.map [v2]

Gerard Ziemski gziemski at openjdk.org
Tue Feb 27 20:24:53 UTC 2024


On Tue, 27 Feb 2024 07:25:54 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?
>
> Thomas Stuefe has updated the pull request incrementally with one additional commit since the last revision:
> 
>   uintx->size_t

Changes requested by gziemski (Committer).

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

> 134:     static uintx last = 0;
> 135:     if (to <= _ranges[last].from) {
> 136:       // not sequential? restart at 0

I would prefer to say something like "the range is to the right of the given section, we need to re-start the search"

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

> 135:     if (to <= _ranges[last].from) {
> 136:       // not sequential? restart at 0
> 137:       last = 0;

If we know that the current region is to the right of the given section, couldn't we just start moving to left, one region at the time, instead of re-starting at 0?

This would be an optimization on top of your optimization, but since we are already touching this might as well consider it?

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

PR Review: https://git.openjdk.org/jdk/pull/17984#pullrequestreview-1904730486
PR Review Comment: https://git.openjdk.org/jdk/pull/17984#discussion_r1504923880
PR Review Comment: https://git.openjdk.org/jdk/pull/17984#discussion_r1504927207


More information about the hotspot-runtime-dev mailing list