crash —— 查看进程的vma结构体

简介: crash —— 查看进程的vma结构体

crash提供了vm命令来输出进程的vma相关的信息。

输出当前当进程的vma列表

crash> vm
PID: 3319   TASK: ffff889760358000  CPU: 6   COMMAND: "kvm"
       MM               PGD          RSS    TOTAL_VM
ffff893ada165000  ffff893a8c4e2000  45772k  9535832k
      VMA           START       END     FLAGS FILE
ffff893a7eab1960 55b4b8274000 55b4b90d6000 8000875 /sf/bin/qemu-system-x86_64
ffff893a7eab1ed0 55b4b92d5000 55b4b9476000 8100875 /sf/bin/qemu-system-x86_64
ffff893cb6d533f0 55b4b9476000 55b4b956d000 8100877 /sf/bin/qemu-system-x86_64
ffff893a7eab1c18 55b4b956d000 55b4b9597000 8100077
ffff888bb1fbc828 7efa95dcf000 7efa95dd0000 8100070
ffff88ddadc64658 7efa95dd0000 7efa965d0000 8100077
ffff88d5d679bed0 7efa965d0000 7efa965d1000 8100070
...

查看指定进程的vma列表

crash> vm -p 2085
PID: 2085   TASK: ffff88dcca1fa000  CPU: 61  COMMAND: "supervisor"
       MM               PGD          RSS    TOTAL_VM
ffff88dea7232000  ffff88ddab4aa000  1960k    16960k
      VMA           START       END     FLAGS FILE
ffff88dcc9122658     400000     40e000 8000875 /sf/bin/supervisor
VIRTUAL     PHYSICAL
400000      5e6cdf6000
401000      5e57277000
...
40c000      5e6efca000
40d000      5e7ad44000
      VMA           START       END     FLAGS FILE
ffff88dcc9123308     60d000     60e000 8100871 /sf/bin/supervisor
VIRTUAL     PHYSICAL
60d000      5be9452000
      VMA           START       END     FLAGS FILE
ffff88dcc9123960     60e000     60f000 8100873 /sf/bin/supervisor
VIRTUAL     PHYSICAL
60e000      5c00fdd000
      VMA           START       END     FLAGS FILE
ffff88dcc91222b8    2381000    23a6000 8100073
VIRTUAL     PHYSICAL
2381000     5c181b3000
2382000     5bdd057000
2383000     5c30e4f000
...
      VMA           START       END     FLAGS FILE
ffff88dcc9123d00 7fa1cecdd000 7fa1cece0000 8000075 /lib/x86_64-linux-gnu/libdl-2.23.so
VIRTUAL     PHYSICAL
7fa1cecdd000  5e4ad82000
7fa1cecde000  5e6359c000
7fa1cecdf000  5e58939000
      VMA           START       END     FLAGS FILE
ffff88dcc91223a0 7fa1cece0000 7fa1ceedf000 8000070 /lib/x86_64-linux-gnu/libdl-2.23.so
VIRTUAL     PHYSICAL
7fa1cece0000  FILE: /lib/x86_64-linux-gnu/libdl-2.23.so  OFFSET: 3000
7fa1cece1000  FILE: /lib/x86_64-linux-gnu/libdl-2.23.so  OFFSET: 4000
7fa1cece2000  FILE: /lib/x86_64-linux-gnu/libdl-2.23.so  OFFSET: 5000
7fa1cece3000  FILE: /lib/x86_64-linux-gnu/libdl-2.23.so  OFFSET: 6000
...
      VMA           START       END     FLAGS FILE
ffff88dcc91236a8 7fa1cf0a1000 7fa1cf2a1000 8000070 /lib/x86_64-linux-gnu/libc-2.23.so
VIRTUAL     PHYSICAL
7fa1cf0a1000  FILE: /lib/x86_64-linux-gnu/libc-2.23.so  OFFSET: 1c0000
7fa1cf0a2000  FILE: /lib/x86_64-linux-gnu/libc-2.23.so  OFFSET: 1c1000
7fa1cf0a3000  FILE: /lib/x86_64-linux-gnu/libc-2.23.so  OFFSET: 1c2000
...
7fa1cf29f000  FILE: /lib/x86_64-linux-gnu/libc-2.23.so  OFFSET: 3be000
7fa1cf2a0000  FILE: /lib/x86_64-linux-gnu/libc-2.23.so  OFFSET: 3bf000
      VMA           START       END     FLAGS FILE
ffff88dcc9123790 7fa1cf2a1000 7fa1cf2a5000 8100071 /lib/x86_64-linux-gnu/libc-2.23.so
VIRTUAL     PHYSICAL
7fa1cf2a1000  5b9e194000
7fa1cf2a2000  5c77e48000
7fa1cf2a3000  5c14c49000
7fa1cf2a4000  5be52cf000
      VMA           START       END     FLAGS FILE
ffff88dcc9123a48 7fa1cf2a5000 7fa1cf2a7000 8100073 /lib/x86_64-linux-gnu/libc-2.23.so
VIRTUAL     PHYSICAL
7fa1cf2a5000  5c65e5e000
7fa1cf2a6000  5c22353000
      VMA           START       END     FLAGS FILE
ffff88dcc9122570 7fa1cf2a7000 7fa1cf2ab000 8100073
VIRTUAL     PHYSICAL
7fa1cf2a7000  5bbfd52000
7fa1cf2a8000  5c0957a000
7fa1cf2a9000  (not mapped)
7fa1cf2aa000  5c7a4ea000
...

查看指定进程的指定vma的的内容

下面查看进程2085的vma:ffff88dcc9122570的信息:

crash> vm  -P ffff88dcc9122570 2085
PID: 2085   TASK: ffff88dcca1fa000  CPU: 61  COMMAND: "supervisor"
      VMA           START       END     FLAGS FILE
ffff88dcc9122570 7fa1cf2a7000 7fa1cf2ab000 8100073
VIRTUAL     PHYSICAL
7fa1cf2a7000  5bbfd52000
7fa1cf2a8000  5c0957a000
7fa1cf2a9000  (not mapped)
7fa1cf2aa000  5c7a4ea000

或者使用2085进程的task_struct结构体的地址ffff88dcca1fa000:

crash> vm  -P ffff88dcc9122570 ffff88dcca1fa000
PID: 2085   TASK: ffff88dcca1fa000  CPU: 61  COMMAND: "supervisor"
      VMA           START       END     FLAGS FILE
ffff88dcc9122570 7fa1cf2a7000 7fa1cf2ab000 8100073
VIRTUAL     PHYSICAL
7fa1cf2a7000  5bbfd52000
7fa1cf2a8000  5c0957a000
7fa1cf2a9000  (not mapped)
7fa1cf2aa000  5c7a4ea000

查看某个进程的vma结构体的内容

crash> vm -x -v 2085
PID: 2085   TASK: ffff88dcca1fa000  CPU: 61  COMMAND: "supervisor"
struct vm_area_struct {
  vm_start = 0x400000,
  vm_end = 0x40e000,
  vm_next = 0xffff88dcc9123308,
  vm_prev = 0x0,
  vm_rb = {
    __rb_parent_color = 0xffff88dcc9123329,
    rb_right = 0x0,
    rb_left = 0x0
  },
  rb_subtree_gap = 0x400000,
  vm_mm = 0xffff88dea7232000,
  vm_page_prot = {
    pgprot = 0x25
  },
  vm_flags = 0x8000875,
  shared = {
    rb = {
      __rb_parent_color = 0xffff893cb8ff5f28,
      rb_right = 0x0,
      rb_left = 0x0
    },
    rb_subtree_last = 0xd
  },
  anon_vma_chain = {
    next = 0xffff88dcc91226d0,
    prev = 0xffff88dcc91226d0
  },
  anon_vma = 0x0,
  vm_ops = 0xffffffff81e36e00 <generic_file_vm_ops>,
  vm_pgoff = 0x0,
  vm_file = 0xffff88ddae938c00,
...
}
...
struct vm_area_struct {
  vm_start = 0x7ffe1cb03000,
  vm_end = 0x7ffe1cb05000,
  vm_next = 0x0,
  vm_prev = 0xffff88dcc831e9f8,
  vm_rb = {
    __rb_parent_color = 0xffff88dcc831ea18,
    rb_right = 0x0,
    rb_left = 0x0
  },
  rb_subtree_gap = 0x0,
  vm_mm = 0xffff88dea7232000,
  vm_page_prot = {
    pgprot = 0x25
  },
  vm_flags = 0x8040075,
  shared = {
    rb = {
      __rb_parent_color = 0x0,
      rb_right = 0x0,
      rb_left = 0x0
    },
    rb_subtree_last = 0x0
  },
  anon_vma_chain = {
    next = 0xffff88dcc831fd78,
    prev = 0xffff88dcc831fd78
  },
  anon_vma = 0x0,
  vm_ops = 0xffffffff81e3a100 <special_mapping_vmops>,
  vm_pgoff = 0x0,
  vm_file = 0x0,
  vm_private_data = 0xffffffff81e00f20 <vdso_mapping>,
...
}
相关文章
|
2月前
crash —— 输出属于同一个进程的所有线程
crash —— 输出属于同一个进程的所有线程
|
2月前
crash —— 查看进程的内核栈的内容
crash —— 查看进程的内核栈的内容
|
2月前
crash —— 查看进程的mm_struct内容
crash —— 查看进程的mm_struct内容
进程crash报错1000
进程crash,在应用程序日志里看到有1000 的报错
进程crash报错1000
|
5月前
|
监控 Linux 应用服务中间件
探索Linux中的`ps`命令:进程监控与分析的利器
探索Linux中的`ps`命令:进程监控与分析的利器
118 13
|
4月前
|
运维 关系型数据库 MySQL
掌握taskset:优化你的Linux进程,提升系统性能
在多核处理器成为现代计算标准的今天,运维人员和性能调优人员面临着如何有效利用这些处理能力的挑战。优化进程运行的位置不仅可以提高性能,还能更好地管理和分配系统资源。 其中,taskset命令是一个强大的工具,它允许管理员将进程绑定到特定的CPU核心,减少上下文切换的开销,从而提升整体效率。
掌握taskset:优化你的Linux进程,提升系统性能
|
4月前
|
弹性计算 Linux 区块链
Linux系统CPU异常占用(minerd 、tplink等挖矿进程)
Linux系统CPU异常占用(minerd 、tplink等挖矿进程)
144 4
Linux系统CPU异常占用(minerd 、tplink等挖矿进程)
|
3月前
|
算法 Linux 调度
探索进程调度:Linux内核中的完全公平调度器
【8月更文挑战第2天】在操作系统的心脏——内核中,进程调度算法扮演着至关重要的角色。本文将深入探讨Linux内核中的完全公平调度器(Completely Fair Scheduler, CFS),一个旨在提供公平时间分配给所有进程的调度器。我们将通过代码示例,理解CFS如何管理运行队列、选择下一个运行进程以及如何对实时负载进行响应。文章将揭示CFS的设计哲学,并展示其如何在现代多任务计算环境中实现高效的资源分配。
|
4月前
|
存储 缓存 安全
【Linux】冯诺依曼体系结构与操作系统及其进程
【Linux】冯诺依曼体系结构与操作系统及其进程
168 1

相关实验场景

更多