正在运行的进程的 vm.max_map_count ?

正在运行的进程的 vm.max_map_count ?

有没有办法确定正在运行的进程的 vm.max_map_count ?

我使用的是 Ubuntu 18.04

答案1

vm.max_map_count 是系统范围内的最大值。

我相信您可以通过计算进程中的行数来找到进程使用的映射数/proc/pid/地图文件

$ cat /proc/173/maps
7fcde28c5000-7fcde28f7000 r--p 00000000 00:00 398275             /usr/lib/locale/C.UTF-8/LC_CTYPE
7fcde28f7000-7fcde2a6a000 r--p 00000000 00:00 398274             /usr/lib/locale/C.UTF-8/LC_COLLATE
7fcde2a6a000-7fcde2d50000 r--p 00000000 00:00 398286             /usr/lib/locale/locale-archive
7fcde2d50000-7fcde2d75000 r--p 00000000 00:00 407224             /usr/lib/x86_64-linux-gnu/libc-2.31.so
7fcde2d75000-7fcde2eed000 r-xp 00025000 00:00 407224             /usr/lib/x86_64-linux-gnu/libc-2.31.so
7fcde2eed000-7fcde2f37000 r--p 0019d000 00:00 407224             /usr/lib/x86_64-linux-gnu/libc-2.31.so
7fcde2f37000-7fcde2f38000 ---p 001e7000 00:00 407224             /usr/lib/x86_64-linux-gnu/libc-2.31.so
7fcde2f38000-7fcde2f3b000 r--p 001e7000 00:00 407224             /usr/lib/x86_64-linux-gnu/libc-2.31.so
7fcde2f3b000-7fcde2f3e000 rw-p 001ea000 00:00 407224             /usr/lib/x86_64-linux-gnu/libc-2.31.so
7fcde2f3e000-7fcde2f42000 rw-p 00000000 00:00 0
7fcde2f4e000-7fcde2f4f000 r--p 00000000 00:00 398282             /usr/lib/locale/C.UTF-8/LC_NUMERIC
7fcde2f4f000-7fcde2f50000 r--p 00000000 00:00 398285             /usr/lib/locale/C.UTF-8/LC_TIME
7fcde2f50000-7fcde2f5e000 r--p 00000000 00:00 407648             /usr/lib/x86_64-linux-gnu/libtinfo.so.6.2
7fcde2f5e000-7fcde2f6d000 r-xp 0000e000 00:00 407648             /usr/lib/x86_64-linux-gnu/libtinfo.so.6.2
7fcde2f6d000-7fcde2f7b000 r--p 0001d000 00:00 407648             /usr/lib/x86_64-linux-gnu/libtinfo.so.6.2
7fcde2f7b000-7fcde2f7f000 r--p 0002a000 00:00 407648             /usr/lib/x86_64-linux-gnu/libtinfo.so.6.2
7fcde2f7f000-7fcde2f80000 rw-p 0002e000 00:00 407648             /usr/lib/x86_64-linux-gnu/libtinfo.so.6.2
7fcde2f80000-7fcde2f83000 rw-p 00000000 00:00 0
7fcde2f83000-7fcde2f84000 r--p 00000000 00:00 398280             /usr/lib/locale/C.UTF-8/LC_MONETARY
7fcde2f84000-7fcde2f85000 r--p 00000000 00:00 398279             /usr/lib/locale/C.UTF-8/LC_MESSAGES/SYS_LC_MESSAGES
7fcde2f85000-7fcde2f86000 r--p 00000000 00:00 398283             /usr/lib/locale/C.UTF-8/LC_PAPER
7fcde2f86000-7fcde2f87000 r--p 00000000 00:00 398281             /usr/lib/locale/C.UTF-8/LC_NAME
7fcde2f87000-7fcde2f88000 r--p 00000000 00:00 398273             /usr/lib/locale/C.UTF-8/LC_ADDRESS
7fcde2f88000-7fcde2f89000 r--p 00000000 00:00 398284             /usr/lib/locale/C.UTF-8/LC_TELEPHONE
7fcde2f89000-7fcde2f90000 r--s 00000000 00:00 407071             /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
7fcde2f90000-7fcde2f91000 r--p 00000000 00:00 407107             /usr/lib/x86_64-linux-gnu/ld-2.31.so
7fcde2f91000-7fcde2fb3000 r-xp 00001000 00:00 407107             /usr/lib/x86_64-linux-gnu/ld-2.31.so
7fcde2fb3000-7fcde2fb4000 r-xp 00023000 00:00 407107             /usr/lib/x86_64-linux-gnu/ld-2.31.so
7fcde2fb4000-7fcde2fbb000 r--p 00024000 00:00 407107             /usr/lib/x86_64-linux-gnu/ld-2.31.so
7fcde2fbb000-7fcde2fbc000 r--p 0002b000 00:00 407107             /usr/lib/x86_64-linux-gnu/ld-2.31.so
7fcde2fbc000-7fcde2fbd000 r--p 00000000 00:00 398277             /usr/lib/locale/C.UTF-8/LC_MEASUREMENT
7fcde2fbd000-7fcde2fbe000 r--p 0002c000 00:00 407107             /usr/lib/x86_64-linux-gnu/ld-2.31.so
7fcde2fbe000-7fcde2fbf000 rw-p 0002d000 00:00 407107             /usr/lib/x86_64-linux-gnu/ld-2.31.so
7fcde2fbf000-7fcde2fc2000 rw-p 00000000 00:00 0
7fcde2fc2000-7fcde2fc3000 r--p 00000000 00:00 398276             /usr/lib/locale/C.UTF-8/LC_IDENTIFICATION
7fcde2fc3000-7fcde2fc6000 r--p 00000000 00:00 397207             /usr/bin/less
7fcde2fc6000-7fcde2fc7000 r--p 00003000 00:00 397207             /usr/bin/less
7fcde2fc7000-7fcde2fde000 r-xp 00004000 00:00 397207             /usr/bin/less
7fcde2fde000-7fcde2fdf000 r-xp 0001b000 00:00 397207             /usr/bin/less
7fcde2fdf000-7fcde2fe9000 r--p 0001c000 00:00 397207             /usr/bin/less
7fcde2fe9000-7fcde2fea000 r--p 00026000 00:00 397207             /usr/bin/less
7fcde2feb000-7fcde2fec000 r--p 00027000 00:00 397207             /usr/bin/less
7fcde2fec000-7fcde2ff0000 rw-p 00028000 00:00 397207             /usr/bin/less
7fcde2ff0000-7fcde2ff5000 rw-p 00000000 00:00 0
7fffdf70f000-7fffdf730000 rw-p 00000000 00:00 0                  [heap]
7fffe5eff000-7fffe66ff000 rw-p 00000000 00:00 0                  [stack]
7fffe6a8c000-7fffe6a8d000 r-xp 00000000 00:00 0                  [vdso]

您还可以使用 pmap 命令的输出。

相关内容