Skip to content

Specify priorities for swapfiles #46

@MilesBHuff

Description

@MilesBHuff

As far as I can tell, Swapspace does not currently set priorities for its swapfiles. This means that the kernel swaps evenly across all of Swapspace's swapfiles; this has a significant downside in that, when deallocation happens, much more swap is released into RAM than is necessary. If instead each successive swapfile had a priority one lower than the file before it, the kernel would fill up older swapfiles before using newer ones; this significantly reduces the impacts of deallocating the largest swapfile, and better-aligns with user expectations. See here for an update on this struck-through portion.

What value is best for the default priority is debatable.

  • The max is 32767, but we should leave room to allow for swap devices external to Swapspace (like a swap partition, which many distros create during installation, and which users may be stuck with when they start using Swapspace).
  • The default is to use the highest available negative number, which should only be used for hibernation swapfiles.
  • The minimum configurable value is 0, so we should target a Swapspace min of 0.

If we are only creating up to the 32 swap devices the kernel permits, then having the default priority be 31 will maximize economy.

If this is implemented, then #45 will need to become priority-aware.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions