当Linux内核在NUMA上运行时,每个NUMA节点都有部分独立的内存管理。 There is echo '?' > /proc/sysrq-trigger
函数“将当前内存信息转储到您的控制台。”SysRq(实现为sysrq_handle_showmem
和show_mem
)获取每个NUMA节点到系统控制台,dmesg和系统内核日志的基本内存统计信息。
据我所知,内核的磁盘缓存(page cache)对每个NUMA节点都有内存使用情况,可能来自active_file:%lu inactive_file:%lu
代码show_free_areas
。 (从free
工具输出缓存的行?)
我希望通过频繁更新来监控numa节点上的磁盘缓存使用情况很长时间;我希望不要用SysRq的输出填充整个控制台和dmesg - m
。我计划找到多进程或多线程程序(未绑定到核心或具有亲和力的节点)如何与放置在其他节点内存中的页面缓存页面进行交互。
通过阅读和解析/proc
或/sys
中的某些特殊文件,是否在不使用sysrq的情况下为程序访问发布了此信息(每个NUMA节点的页面缓存内存使用情况)?或者是否需要为此编写新的内核模块?
free
工具使用/proc/meminfo
为整个系统打印cache Memory used by the page cache and slabs;不适用于每个NUMA节点。我无法在proc 5的http://man7.org/linux/man-pages/man5/proc.5.html手册页中找到per-numa内存统计信息。
有numastat:https://www.kernel.org/doc/Documentation/numastat.txt但它没有pagecache内存统计信息;据我所知,它只说明了跨域页面分配计数,当进程经常在NUMA节点之间移动时,这可能毫无用处。
答案 0 :(得分:0)
每个节点都有/sys/devices/system/node/nodeX/meminfo
个文件,其中包含基本内存信息,例如NUMA节点0为/sys/devices/system/node/node0/meminfo
,节点1为/sys/devices/system/node/node1/meminfo
等。
它们应与/proc/meminfo
实用程序实际使用的free
系统范围文件格式类似;其手册页包含meminfo
格式的基本描述:http://man7.org/linux/man-pages/man1/free.1.html
free displays the total amount of free and used physical and swap
memory in the system, as well as the buffers and caches used by the
kernel. The information is gathered by parsing /proc/meminfo. The
displayed columns are:
total Total installed memory (MemTotal and SwapTotal in /proc/meminfo)
used Used memory (calculated as total - free - buffers - cache)
free Unused memory (MemFree and SwapFree in /proc/meminfo)
shared Memory used (mostly) by tmpfs (Shmem in /proc/meminfo)
buffers
Memory used by kernel buffers (Buffers in /proc/meminfo)
cache Memory used by the page cache and slabs (Cached and
SReclaimable in /proc/meminfo)
buff/cache
Sum of buffers and cache
<{3}} 中提到了NUMA的meminfo
What: /sys/devices/system/node/nodeX/meminfo
Date: October 2002
Contact: Linux Memory Management list <linux-mm@kvack.org>
Description:
Provides information about the node's distribution and memory
utilization. Similar to /proc/meminfo, see Documentation/filesystems/proc.txt
并且完整的meminfo描述位于https://www.kernel.org/doc/Documentation/ABI/stable/sysfs-devices-node
你(我)需要&#34;缓存&#34;来自numa节点meminfo的行以获取有关NUMA节点之间的页面缓存分布的信息:
Buffers: Relatively temporary storage for raw disk blocks
shouldn't get tremendously large (20MB or so)
Cached: in-memory cache for files read from the disk (the
pagecache). Doesn't include SwapCached
SReclaimable: Part of Slab, that might be reclaimed, such as caches
旧内存的某些部分可能很脏:
Dirty: Memory which is waiting to get written back to the disk
Writeback: Memory which is actively being written back to the disk
它还显示用户空间任务以匿名方式使用的内存:
AnonPages: Non-file backed pages mapped into userspace page tables
AnonHugePages: Non-file backed huge pages mapped into userspace page tables