vm_compressor_mode (vm.compressor_mode) values for enabled compressed memory in OS X
16
votes
2
answers
18145
views
## Background
In Super user, with an accepted answer :
- **Disable** compressed memory in Mac OS 10.9 Mavericks?
Also in Super User:
- how to get memory compress back in Mac OS 10.9 Mavericks?
– and from the first answer there we understand that the value of *boot argument*
vm_compressor
does not correspond with the value of *sysctl variable* vm.compressor_mode
.
In Apple open source for OS X 10.9, Mavericks; in xnu-2422.1.72:
- vm_compressor.c
- vm_fault.c
- vm_pageout.h
In 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.
*/
On a MacBookPro5,2 with 8 GB memory I find:
sh-3.2$ sysctl -a vm.compressor_mode
vm.compressor_mode: 4
Near the foot of 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))
# Question
Is it possible to have an **enabled** mode other than 4 for compressed memory ?
If so, can we find a plain english explanation of the modes?
Asked by Graham Perrin
(7779 rep)
Jan 27, 2014, 07:10 AM
Last activity: Feb 21, 2019, 01:47 AM
Last activity: Feb 21, 2019, 01:47 AM