16

Background

In Super user, with an accepted answer:

Also in Super User:

– 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:

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?

  • The header file you quote seems to state that both modes 2 and 4 means that the compressed pager is enabled. Therefore I'm a bit puzzled by your question - do you mean that you have actually tried mode 2, and it didn't enable compressed memory? – jksoegaard May 11 '14 at 12:44
  • 1
    See apple.stackexchange.com/q/175572/23761 – poige Oct 31 '15 at 21:22
4

I'm not completely certain of the FREEZER options, other than one FREEZER_COMPRESSOR option uses swap (utilizes free space on a disk) when RAM is low or expended, while the other does not.

What I think is that the FREEZER options are for managing memory for frozen processes. Maybe this is something experimental, to be used in combination with App Nap? I think this was something they were testing with iOS a few years back.

What I know is that option 1 uses no compression, and is the old fashioned OS X memory management we're all more familiar with. If you're having issues you suspect are related to memory compression, you might try this setting.

Option 2 uses compressed memory with no swap (no writing to disk when RAM is low or expended).

Option 4 uses both compression and swap.

Option 8 uses whatever the FREEZER is, backed by the option 1 implementation.

  • 2
    Is there actual documentation on what the FREEZER does? – vy32 Feb 16 '16 at 13:19
  • It’s interesting that the edit to apple.stackexchange.com/questions/175572 says Apple responded to a radar or feedback or support case and the traditional option 1 is known to fail in some cases and is no longer a supported mode. – bmike Jan 12 at 14:12
0

Can't add a comment, so I'll write as answer: Looks like freezer is Apple's patented technology and if you'll use VM_PAGER_FREEZER_COMPRESSOR_NO_SWAP it shouldn't use the compressor too? (see, compressor is present, but isn't activated)

Answering the question, you can have:

  1. VM_PAGER_COMPRESSOR_WITH_SWAP - compressed memory + swap
  2. VM_PAGER_COMPRESSOR_NO_SWAP - compressed memory w/o swap
  3. VM_PAGER_COMPRESSOR_NO_SWAP_PLUS_FREEZER_COMPRESSOR_WITH_SWAP - compressed memory + freezer's swap

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .