Skip to content

Instantly share code, notes, and snippets.

View tristone13th's full-sized avatar
🎯
Focusing

Leinux tristone13th

🎯
Focusing
View GitHub Profile
@tristone13th
tristone13th / content.md
Created January 8, 2025 09:03 — forked from baymaxium/content.md
知其然知其所以然,/PROC/MEMINFO之谜

原文:运维帮

转自:http://linuxperf.com/?p=142

作者:VMUNIX,已授权运维帮转发

/proc/meminfo是了解Linux系统内存使用状况的主要接口,我们最常用的”free”、”vmstat”等命令就是通过它获取数据的 ,/proc/meminfo所包含的信息比”free”等命令要丰富得多,然而真正理解它并不容易,比如我们知道”Cached”统计的是文件缓存页,manpage上说是“In-memory  cache  for  files read from the disk (the page cache)”,那为什么它不等于[Active(file)+Inactive(file)]?AnonHugePages与AnonPages、HugePages_Total有什么联系和区别?很多细节在手册中并没有讲清楚,本文对此做了一点探究。

负责输出/proc/meminfo的源代码是:fs/proc/meminfo.c : meminfo_proc_show()