RE: FreeBSD 14-0 file swapping broken.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 09 Jun 2024 18:43:31 UTC
Artem Hevorhian <artemhevorhian_at_gmail.com> wrote on Date: Sun, 09 Jun 2024 15:30:21 UTC : > I would like to report that, likely, in FreeBSD version 14.0-stable, file > swapping is broken. To confirm, here is what I tried to do and what I > achieved. In order to reproduce the problem, please follow the following > steps. > > I was following this tutorial > https://www.cyberciti.biz/faq/create-a-freebsd-swap-file/ > > I created a large swap file (8192 MiB) and saved it to /root/swap.8G.bin. > > After that, I ran > > sudo chmod 0600 /root/swap.8G.bin > > After that, I updated fstab by adding the following line to the end. > > md42 none swap sw,file=/root/swap.8G.bin 0 0 > > On running > > sudo swapon -aq > > I got the swap file working initially, and I saw it after running swapinfo. > But on reboot, it disappeared. Going a different direction than how to enable using of swap files is the following. It is not FreeBSD version specific for any supported version (RELEASE or STABLE) or for main [future: 15.*] and has a long history going back into now long unsupported versions. QUOTE ( of https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=206048#c7 ) On 2017-Feb-13, at 7:20 PM, Konstantin Belousov <kostikbel at gmail.com> wrote on the freebsd-arm list: . . . 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. END QUOTE Summary consequence: I recommend only using swap partitions, not swap files. Yes, I have suffered deadlocks from attempted swap file use, with just UFS over umass (USB SSD) being what held the the swap file in question. === Mark Millard marklmi at yahoo.com