linux中page数据结构可以通过mem_map数组访问,下面的方法可以输出每个page的相关成员。
通用版本
下面这个命令可以显示每个page的一些关键成员的值。
crash> kmem -p PAGE PHYSICAL MAPPING INDEX CNT FLAGS ffffea0000000000 0 0 0 1 fffc0000001000 reserved ffffea0000000040 1000 0 0 1 fffc0000001000 reserved ffffea0000000080 2000 0 0 1 fffc0000001000 reserved ffffea00000000c0 3000 0 0 1 fffc0000001000 reserved ffffea0000000100 4000 0 0 1 fffc0000001000 reserved ffffea0000000140 5000 0 0 1 fffc0000001000 reserved ffffea0000000180 6000 0 0 1 fffc0000001000 reserved ffffea00000001c0 7000 0 0 1 fffc0000001000 reserved ...
定制
除了上面固定输出一些字段,也可以定制输出page的指定字段的值
crash> kmem -m flags,_mapcount,_refcount,lru,index,mapping PAGE flags _mapcount _refcount lru index mapping ffffea0000000000 0000000000000800 0 00000000ffffea0000000008,ffffea0000000008 0 0000000000000000 ffffea0000000040 0000000000000800 -1 00000001ffffea0000000048,ffffea0000000048 0 0000000000000000 ffffea0000000080 0000000000000800 -1 00000001ffffea0000000088,ffffea0000000088 0 0000000000000000 ffffea00000000c0 0000000000000800 -1 00000001ffffea00000000c8,ffffea00000000c8 0 0000000000000000 ffffea0000000100 0000000000000800 -1 00000001ffffea0000000108,ffffea0000000108 0 0000000000000000 ffffea0000000140 0000000000000800 -1 00000001ffffea0000000148,ffffea0000000148 0 0000000000000000 ffffea0000000180 0000000000000800 -1 00000001ffffea0000000188,ffffea0000000188 0 0000000000000000 ffffea00000001c0 0000000000000800 -1 00000001ffffea00000001c8,ffffea00000001c8 0 0000000000000000 ffffea0000000200 0000000000000800 -1 00000001ffffea0000000208,ffffea0000000208 0 0000000000000000 ffffea0000000240 0000000000000800 -1 00000001ffffea0000000248,ffffea0000000248 0 0000000000000000 ...