questions about swap (partition and file)

tech-lists tech-lists at zyxst.net
Tue Feb 11 16:21:59 UTC 2020


Hi,

On Tue, Feb 11, 2020 at 04:55:25PM +0100, Polytropon wrote:
>On Tue, 11 Feb 2020 15:50:09 +0000, tech-lists wrote:
>> Which is it better to have - swapfile partition or swapfile?
>>
>> I have both, on a SSD. Thing is, I can write 10x faster to the
>> file than I can
>> to the partition. With a 512b block size, it can write at 17MB/s
>> to the
>> partition, and about 120-130MB/s to the swapfile, as reported by dd.
>
>Probably a partition is better because it saves the subsystems
>accessing it to deal with the filesystem layer. A swap device
>does not have a filesystem, and it's not under VFS control, so
>no overhead of that kind.

But given there's no overhead, then why on the face of it is it slower than a
swapfile?
>
>However, it is possible to "emulate" a swap device with a file,
>and there are probably several ways to do this (for example,
>virtual node: mdconfig + swapctl, 

I have these at the moment in my /etc/fstab:

/dev/ada0s1b none  swap sw 0 0
md99 none swap      sw,file=/swap0,late 0 0
md98 none swap      sw,file=/swap1,late 0 0

The amount of RAM in the machine is 32GB, the swap partition is 4GB and each
swapfile is 32GB

The *reasoning behind* asking this is I use this machine for poudriere, and
sometimes I'll see this in the logs:

swap_pager: out of swap space
swap_pager_getswapspace(10): failed
swap_pager: indefinite wait buffer: bufobj: 0, blkno: 22294, size: 40960

and this happens even when not even half of the swap space has been used. 
Only the "out of swap space" problem happens when *only* the swap partition 
is enabled, when the swap partition fills up.

I thought the indefinite wait buffer problem might be happening with just the
swapfile, and that seems the case, but there is no defect with the SSD. I have
run it through fsck several times and all is good. smartmontools reports no
defects.

What I want is the swapfile to work like a swap partition and not report OOS
errors when swap has not been exhausted.
-- 
J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20200211/8f4a5e1c/attachment.sig>


More information about the freebsd-questions mailing list