背景
在超级用户中,具有可接受的答案:
同样在超级用户中:
–从第一个答案开始,我们了解到boot参数 vm_compressor
的值与sysctl变量 的值不对应vm.compressor_mode
。
在OS X 10.9的Apple开放源代码中,Mavericks;在xnu-2422.1.72中:
在vm_compressor.c中:
/*
* vm_compressor_mode has a heirarchy of control to set its value.
* boot-args are checked first, then device-tree, and finally
* the default value that is defined below. See vm_fault_init() for
* the boot-arg & device-tree code.
*/
在具有8 GB内存的MacBookPro5,2上,我发现:
sh-3.2$ sysctl -a vm.compressor_mode
vm.compressor_mode: 4
在vm_pageout.h的脚附近:
extern int vm_compressor_mode;
extern int vm_compressor_thread_count;
#define VM_PAGER_DEFAULT 0x1 /* Use default pager. */
#define VM_PAGER_COMPRESSOR_NO_SWAP 0x2 /* In-core compressor only. */
#define VM_PAGER_COMPRESSOR_WITH_SWAP 0x4 /* In-core compressor + swap backend. */
#define VM_PAGER_FREEZER_DEFAULT 0x8 /* Freezer backed by default pager.*/
#define VM_PAGER_FREEZER_COMPRESSOR_NO_SWAP 0x10 /* Freezer backed by in-core compressor only i.e. frozen data remain in-core compressed.*/
#define VM_PAGER_FREEZER_COMPRESSOR_WITH_SWAP 0x20 /* Freezer backed by in-core compressor with swap support too.*/
#define VM_PAGER_MAX_MODES 6 /* Total number of vm compressor modes supported */
#define DEFAULT_PAGER_IS_ACTIVE ((vm_compressor_mode & VM_PAGER_DEFAULT) == VM_PAGER_DEFAULT)
#define COMPRESSED_PAGER_IS_ACTIVE (vm_compressor_mode & (VM_PAGER_COMPRESSOR_NO_SWAP | VM_PAGER_COMPRESSOR_WITH_SWAP))
#define DEFAULT_FREEZER_IS_ACTIVE ((vm_compressor_mode & VM_PAGER_FREEZER_DEFAULT) == VM_PAGER_FREEZER_DEFAULT)
#define DEFAULT_FREEZER_COMPRESSED_PAGER_IS_ACTIVE (vm_compressor_mode & (VM_PAGER_FREEZER_COMPRESSOR_NO_SWAP | VM_PAGER_FREEZER_COMPRESSOR_WITH_SWAP))
题
压缩内存是否可以启用 4以外的启用模式?
如果是这样,我们可以找到关于这些模式的简单英语解释吗?
您引用的头文件似乎表明模式2和4都意味着启用了压缩的寻呼机。因此,我对您的问题感到困惑-您是说您实际上已经尝试了模式2,但是它没有启用压缩内存?
—
jksoegaard,2014年