RFR: JDK-8322475: Extend printing for System.map
Stefan Karlsson
stefank at openjdk.org
Fri Dec 22 13:15:51 UTC 2023
On Tue, 19 Dec 2023 15:48:58 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
> This is an expansion on the new `System.map` command introduced with JDK-8318636.
>
> We now print valuable information per memory region, such as:
>
> - the actual resident set size
> - the actual number of huge pages
> - the actual used page size
> - the THP state of the region (was advised, is eligible, uses THP, ...)
> - whether the region is shared
> - whether the region had been committed (backed by swap)
> - whether the region has been swapped out.
>
> Example output:
>
>
> from to size rss hugetlb pgsz prot notes vm info/file
> 0x00000000c0000000 - 0x00000000ffe00000 1071644672 0 4194304 2M rw-p huge JAVAHEAP /anon_hugepage
> 0x00000000ffe00000 - 0x0000000100000000 2097152 0 0 2M rw-p huge JAVAHEAP /anon_hugepage
> 0x0000558016b67000 - 0x0000558016b68000 4096 4096 0 4K r--p /shared/projects/openjdk/jdk-jdk/output-fastdebug/images/jdk/bin/java
> 0x0000558016b68000 - 0x0000558016b69000 4096 4096 0 4K r-xp /shared/projects/openjdk/jdk-jdk/output-fastdebug/images/jdk/bin/java
> 0x00007f3a749f2000 - 0x00007f3a74c62000 2555904 2555904 0 4K rwxp CODE(CodeHeap 'profiled nmethods')
> 0x00007f3a74c62000 - 0x00007f3a7be51000 119468032 0 0 4K ---p nores CODE(CodeHeap 'profiled nmethods')
> 0x00007f3a7be51000 - 0x00007f3a7c1c1000 3604480 3604480 0 4K rwxp CODE(CodeHeap 'profiled nmethods')
> 0x00007f3a7c1c1000 - 0x00007f3a7c592000 4001792 0 0 4K ---p nores CODE(CodeHeap 'non-nmethods')
> 0x00007f3a7c592000 - 0x00007f3a7c802000 2555904 2555904 0 4K rwxp CODE(CodeHeap 'non-profiled nmethods')
> 0x00007f3a7c802000 - 0x00007f3a839f200...
Just some initial comments after reading through the patch.
src/hotspot/os/linux/memMapPrinter_linux.cpp line 31:
> 29: #include "nmt/memMapPrinter.hpp"
> 30: #include "utilities/align.hpp"
> 31: #include "utilities/powerOfTwo.hpp"
This include section is not sorted correctly. It would also be good to add a blank line between the hotspot includes and the system includes.
src/hotspot/os/linux/memMapPrinter_linux.cpp line 206:
> 204: _swapped_out(0), _hugetlb(0), _thp(0) {}
> 205:
> 206: void add_mapping(ProcMapsInfo& info) {
`info` could be const ref.
src/hotspot/os/linux/memMapPrinter_linux.cpp line 207:
> 205:
> 206: void add_mapping(ProcMapsInfo& info) {
> 207: _num_mappings ++;
We tend to not put a space before `++` in HotSpot code.
src/hotspot/os/linux/memMapPrinter_linux.cpp line 250:
> 248: st->print_cr(" thpel: mapping is eligible for THP");
> 249: st->print_cr(" thpadv: mapping is THP-madvised");
> 250: st->print_cr(" nothp: mapping will not THP");
"mapping will not THP" sounds a bit weird.
src/hotspot/os/linux/memMapPrinter_linux.cpp line 276:
> 274: }
> 275:
> 276: FILE* f = os::fopen("/proc/self/smaps", "r");
We have seen that reading the smaps file can be extremely bad for the latency of the process. We've seen multi-seconds hangs because of external tools reading smaps. If we add a tool like this it would be good to add a big warning somewhere.
src/hotspot/share/nmt/memMapPrinter.cpp line 30:
> 28: #ifdef LINUX
> 29:
> 30: #include "code/codeCache.hpp"
The include lines below are weirdly sorted. Could you fix it while you are changing this file?
-------------
PR Review: https://git.openjdk.org/jdk/pull/17158#pullrequestreview-1794452228
PR Review Comment: https://git.openjdk.org/jdk/pull/17158#discussion_r1435045106
PR Review Comment: https://git.openjdk.org/jdk/pull/17158#discussion_r1435037709
PR Review Comment: https://git.openjdk.org/jdk/pull/17158#discussion_r1435037943
PR Review Comment: https://git.openjdk.org/jdk/pull/17158#discussion_r1435040208
PR Review Comment: https://git.openjdk.org/jdk/pull/17158#discussion_r1435041926
PR Review Comment: https://git.openjdk.org/jdk/pull/17158#discussion_r1435042952
More information about the hotspot-dev
mailing list