RFR: JDK-8322475: Extend printing for System.map

Thomas Stuefe stuefe at openjdk.org
Tue Dec 19 17:34:21 UTC 2023


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 - 0x00007f3a839f2000  119472128          0          0 4K   ---p nores            CODE(CodeHeap 'non-profiled nmethods') 


The summary section shows:
- number of mappings
- total vsize
- total rss
- total size of hugetlb memory
- how much memory got merged to THPs
- how much memory had been swapped out
- used (dirty) pages by page size

Example: (the machine uses THP mode "always" and the VM was started with +UseLargePages, therefore we see both static huge pages and THPs being used):


Number of mappings: 334
             vsize: 8649248768 (8248M)
               rss: 3318468608 (3164M)
         committed: 1431310336 (1365M)
            shared: 32768 (32768B)
       swapped out: 409600 (400K)
         using thp: 12582912 (12288K)
           hugetlb: 572522496 (546M)
By page size:
                4K: 810173 pages, 3318468608 bytes (3164M)
                2M: 273 pages, 572522496 bytes (546M)



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

Patch:

- I simplified the back-and-forth between the OS-agnostic part of the printing and the OS-dependend part of the printing.
- I removed the "human readable" option of the commands, since these were of not much use.

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

Commit messages:
 - Extend System.map on Linux

Changes: https://git.openjdk.org/jdk/pull/17158/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17158&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8322475
  Stats: 398 lines in 8 files changed: 271 ins; 85 del; 42 mod
  Patch: https://git.openjdk.org/jdk/pull/17158.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/17158/head:pull/17158

PR: https://git.openjdk.org/jdk/pull/17158


More information about the hotspot-dev mailing list