Out of swap - NOT

Konstantin Belousov kostikbel at gmail.com
Tue Feb 14 03:20:45 UTC 2017


On Mon, Feb 13, 2017 at 04:46:04PM -0500, Brett Wynkoop wrote:
> On Mon, 13 Feb 2017 15:55:11 -0500
> Joe Nosay <superbisquit at gmail.com> wrote:
> 
> > Is it possible to place the swap on a separate disk such as a usb?
> 
> Yes, but I am not sure what difference that will make.  I would think a
> swapfile is a swapfile.  Yes I am swapping on a file because the image
> autogrew the filesystem on first boot, so no chance to set up a
> partition.
swapfile write requires the write request to come through the filesystem
write path, which might require the filesystem to allocate more memory
and read some data. E.g. it is known that any ZFS write request
allocates memory, and that write request on large UFS file might require
allocating and reading an indirect block buffer to find the block number
of the written block, if the indirect block was not yet read.

As result, swapfile swapping is more prone to the trivial and unavoidable
deadlocks where the pagedaemon thread, which produces free memory, needs
more free memory to make a progress.  Swap write on the raw partition over
simple partitioning scheme directly over HBA are usually safe, while e.g.
zfs over geli over umass is the worst construction.


More information about the freebsd-arm mailing list