linux内存状态

来自个人维基
跳转至: 导航搜索
F:\t\a\0928> adb shell cat /proc/buddyinfo
Node 0, zone   Normal   5117    255      6      0      0      0      0      0      0      0      0
Node 0, zone  HighMem    282     89      9      0      0      0      0      0      0      0      0

F:\t\a\0928> adb shell cat /proc/pagetypeinfo
Page block order: 10
Pages per block:  1024

Free pages count per migrate type at order       0      1      2      3      4      5      6      7      8      9     10
Node    0, zone   Normal, type    Unmovable   1936      9      0      0      0      0      0      0      0      0      0
Node    0, zone   Normal, type  Reclaimable   2526     12      0      0      0      0      0      0      0      0      0
Node    0, zone   Normal, type      Movable    655    234      6      0      0      0      0      0      0      0      0
Node    0, zone   Normal, type      Reserve      0      0      0      0      0      0      0      0      0      0      0
Node    0, zone   Normal, type      Isolate      0      0      0      0      0      0      0      0      0      0      0
Node    0, zone  HighMem, type    Unmovable    130      2      0      0      0      0      0      0      0      0      0
Node    0, zone  HighMem, type  Reclaimable      0      0      0      0      0      0      0      0      0      0      0
Node    0, zone  HighMem, type      Movable    152     87      9      0      0      0      0      0      0      0      0
Node    0, zone  HighMem, type      Reserve      0      0      0      0      0      0      0      0      0      0      0
Node    0, zone  HighMem, type      Isolate      0      0      0      0      0      0      0      0      0      0      0

Number of blocks type     Unmovable  Reclaimable      Movable      Reserve      Isolate
Node 0, zone   Normal           31           13           84            0            0
Node 0, zone  HighMem           19            0          101            0            0

F:\t\a\0928> adb shell cat /proc/buddyinfo
Node 0, zone   Normal   5117    255      6      0      0      0      0      0      0      0      0
Node 0, zone  HighMem    282     89      9      0      0      0      0      0      0      0      0
  • pagetypeinfo
pagetypeinfo中,前两行是打印当前系统中 block的阶数和大小,这里为10阶,大小为2^10=1024个Page
接下来是打印当前各个内存结点(Node)、内存域(zone)、内存类型(type)中各阶空闲内存的个数,如Normal Movable 2阶内存可用个数为6
最后打印的也是当前系统各类内存的block个数(总个数?,含使用中的和空闲的?)
  • buddyinfo
buddyinfo与pagetypeinfo类似,也是打印当前可用内存的个数,不同的是只对内存域进行了区分,看不到type信息,将pagetypeinfo中各type个数相加,就可以得到buddyinfo中的数据
其实buddyinfo比pagetypeinfo的历史要久得多,pagetypeinfo是随着反碎片技术而引入的,而buddyinfo则是用于打印伙伴系统内存信息的