RFR: 8322475: Extend printing for System.map [v5]

Johan Sjölen jsjolen at openjdk.org
Wed Jun 19 17:19:17 UTC 2024


On Tue, 18 Jun 2024 14:46:31 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')                ...
>
> Thomas Stuefe has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 20 commits:
> 
>  - copyrights
>  - Merge branch 'master' into System.maps-more-info
>  - fix merge issue
>  - Merge branch 'master' into System.maps-more-info
>  - fix whitespace issue
>  - wip
>  - exhuming
>  - Merge branch 'master' into System.maps-more-info
>  - Merge
>  - remove codecache name printing
>  - ... and 10 more: https://git.openjdk.org/jdk/compare/91bd85d6...231a8a91

A first round with this code.

src/hotspot/os/linux/memMapPrinter_linux.cpp line 41:

> 39:   size_t _vsize;        // combined virtual size
> 40:   size_t _rss;          // combined resident set size
> 41:   size_t _committed;    // combined committed space

What's the difference between a "space" and a "size"?

src/hotspot/os/linux/memMapPrinter_linux.cpp line 83:

> 81:     outputStream* st = _session.out();
> 82: #define INDENT_BY(n)          \
> 83:   if (st->fill_to(n) == 0) {  \

`fill_to` returns `void`, am I missing something?

src/hotspot/os/linux/memMapPrinter_linux.cpp line 161:

> 159: 
> 160: void MemMapPrinter::pd_print_all_mappings(const MappingPrintSession& session) {
> 161:   constexpr char filename[] = "/proc/self/smaps";

Is this non-constexpr if it's a `const char *` instead of `char[]`?

src/hotspot/os/linux/procMapsParser.cpp line 95:

> 93:     SCAN(nh);
> 94: #undef SCAN
> 95:     return;

Style: Doesn't matter if the return is here or not.

src/hotspot/os/linux/procMapsParser.inline.hpp line 1:

> 1: /*

Is it important to have these in an inline file? They're very small, seems like they can just be in the header.

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

PR Review: https://git.openjdk.org/jdk/pull/17158#pullrequestreview-2128766725
PR Review Comment: https://git.openjdk.org/jdk/pull/17158#discussion_r1646521846
PR Review Comment: https://git.openjdk.org/jdk/pull/17158#discussion_r1646523960
PR Review Comment: https://git.openjdk.org/jdk/pull/17158#discussion_r1646524764
PR Review Comment: https://git.openjdk.org/jdk/pull/17158#discussion_r1646528449
PR Review Comment: https://git.openjdk.org/jdk/pull/17158#discussion_r1646530621


More information about the hotspot-dev mailing list