/proc/meminfo 中的条目

发布于 2024-07-15 19:16:48 字数 335 浏览 15 评论 0原文

我可以理解 /proc/meminfo 中包含的大部分信息,例如总内存、缓冲区、缓存等。您能告诉我下面列出的不太明显的信息是什么意思吗?

  • AnonPages
  • Mapped
  • Slab
  • NFS_Unstable
  • Bounce
  • VmallocTotal
  • VmallocUsed
  • VmallocChunk

如果有人想知道,我正在谈论 linux 命令 cat /proc/meminfo 的输出

I can make sense of most of the information contained in /proc/meminfo like total memory, buffers, cache etc. Could you tell me what do the less obvious ones like the ones listed below mean?

  • AnonPages
  • Mapped
  • Slab
  • NFS_Unstable
  • Bounce
  • VmallocTotal
  • VmallocUsed
  • VmallocChunk

If anyone is wondering, I am talking about the output of the linux command cat /proc/meminfo

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

惟欲睡 2024-07-22 19:16:49

我的理解如下。
我同意这些数字很难理解并且显示出不一致的值。

  • 内存总计

    = MemFree + 活动 + 非活动 + Slab + 页表 + VmallocUsed + X 
      (X : alloc_pages() (get_free_pages() 等)) 
      

    但是最近内核的 vmallocused 值可能是错误的。
    这是因为它计算 VM_xxx 区域,例如 VM_IOREMAP、VM_MAP...,而不是 VM_ALLOC 区域。

    VM_IOREMAP 区域可以映射内存,该内存可以在内核之外
    内存管理,所以上面的公式可能不精确,或者完全错误。

    你可以这样做:

    • 检查/proc/vmallocinfo,整理所有条目并自行过滤,
    • 修改 fs/proc/mmu.c: get_vmalloc_info() 仅在以下情况下才对区域进行计数
      if(vma->flags & VM_ALLOC)
  • 活动 + 不活动

     = 缓冲区 + 缓存 + SwapCached + AnonPages 
      
  • AnonPages

     = /proc/*/task/*/smaps 匿名区域所有总和 
       (匿名:无名称|[堆]|/dev/zero|/dev/shm/*|[堆栈]) 
      

    虽然我无法匹配这些数字。 请参阅此处 如果您有任何线索,请帮助我。

  • 总页面缓存

     = 缓冲区 + 缓存 + SwapCached 
      
  • Slab

    <代码> = SReclaimable + SUnreclaim 
      

My understanding is as follows.
And I agree these numbers are hard to understand and showing inconsistent values.

  • MemTotal

    = MemFree + Active + Inactive + Slab + PageTables + VmallocUsed + X
    (X : alloc_pages() (get_free_pages(), etc))
    

    But recent kernel's vmallocused value could be wrong.
    This is because it counts VM_xxx regions like VM_IOREMAP, VM_MAP,... other than VM_ALLOC area.

    VM_IOREMAP region can be mapping memory which can be outside of kernel's
    memory management, so the formula above can be not precise, or completely wrong.

    You can either do:

    • Check /proc/vmallocinfo to sort out all the entries and filter by yourself,
    • Modify fs/proc/mmu.c: get_vmalloc_info() to count regions only when
      if(vma->flags & VM_ALLOC)
  • Active + Inactive

     = Buffers + Cached + SwapCached + AnonPages
    
  • AnonPages

     = /proc/*/task/*/smaps anonymous area all sum
     (anonymous: no name|[heap]|/dev/zero|/dev/shm/*|[stack])
    

    Although I haven't been able to match these numbers. See here and help me if you have any clue.

  • Total PageCache

     = Buffers + Cached + SwapCached
    
  • Slab

     = SReclaimable + SUnreclaim
    
知你几分 2024-07-22 19:16:49

来自 RedHat

VMallocTotal — 总金额
总内存(以千字节为单位)
分配的虚拟地址空间。
VMallocUsed — 总量
使用的虚拟内存(以千字节为单位)
地址空间。 VMallocChunk——
最大的连续内存块,在
可用虚拟千字节数
地址空间。

From RedHat

VMallocTotal — The total amount of
memory, in kilobytes, of total
allocated virtual address space.
VMallocUsed — The total amount of
memory, in kilobytes, of used virtual
address space. VMallocChunk — The
largest contiguous block of memory, in
kilobytes, of available virtual
address space.

橘虞初梦 2024-07-22 19:16:48

此信息的规范来源是 /usr/src/linux/Documentation/filesystems/proc.txt。 具体来说,

 AnonPages:映射到用户空间页表的非文件支持页面 
        Mapped:已映射的文件,例如库 
          Slab:内核数据结构缓存 
  NFS_Unstable:NFS页面已发送到服务器,但尚未提交稳定 
          贮存 
        反弹:用于块设备“反弹缓冲区”的内存 
  vmallocTotal:vmalloc内存区域总大小 
   VmallocUsed:已使用的 vmalloc 区域数量 
  VmallocChunk:vmalloc 区域中最大的连续空闲块 
  

The canonical source of this information is /usr/src/linux/Documentation/filesystems/proc.txt. Specifically,

   AnonPages: Non-file backed pages mapped into userspace page tables
      Mapped: files which have been mmaped, such as libraries
        Slab: in-kernel data structures cache
NFS_Unstable: NFS pages sent to the server, but not yet committed to stable
        storage
      Bounce: Memory used for block device "bounce buffers"
VmallocTotal: total size of vmalloc memory area
 VmallocUsed: amount of vmalloc area which is used
VmallocChunk: largest contigious block of vmalloc area which is free
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文