我有一台基于 Marwell Kirkwood ARM 的 NAS 服务器 Zyxel NSA 310。我编译了自己的 3.8 内核并启用了 ZCACHE,但我仍然看到 256 MB 的 RAM。我不确定 GNU 免费实用程序是否应该显示额外的 RAM 量。我怎么知道它真的有效?我需要做一些额外的步骤来使用它吗?我在命令行中添加了“zcache”。
root@nas:~# free -m
total used free shared buffers cached
Mem: 247 218 29 0 7 166
-/+ buffers/cache: 43 203
Swap: 1427 0 1427
root@nas:~# zgrep CACHE /proc/config.gz
CONFIG_CLEANCACHE=y
CONFIG_ZCACHE=y
root@nas:~# dmesg | grep zcache
Kernel command line: console=ttyS0,115200 root=/dev/sda3 zcache
zcache: using lzo compressor
zcache: cleancache enabled using kernel transcendent memory and compression buddies
zcache: cleancache: ignorenonactive = 1
zcache: frontswap enabled using kernel transcendent memory and compression buddies
zcache: frontswap: excl gets = 1 active only = 1
zcache: created ephemeral local tmem pool, id=0
zcache: created persistent local tmem pool, id=1
zcache: created ephemeral local tmem pool, id=2
zcache: created ephemeral local tmem pool, id=3
zcache: created ephemeral local tmem pool, id=4
root@nas:~# cat /proc/cmdline
console=ttyS0,115200 root=/dev/sda3 zcache
Run Code Online (Sandbox Code Playgroud)
我知道它正在“合并”页面压缩它们,但是如何查看压缩率或类似的东西。
小智 1
zcache 埋藏在 RAM 内部,使用当前工具不容易看到。要查看详细信息,您需要安装 debugfs 并查看 /sys/kernel/debug/zcache,其中有一大堆统计信息,比您想要的还要多。frontswap 报告为pers_*(用于持久性),cleancache 报告为eph_*(用于临时性),尽管这些将来可能包括其他类别。cleancache 和 frontswap 存储和加载有单独的目录。