Closed bunder2015 closed 5 years ago
Workaround: set vm.swappiness = 0
, use cgroups with memory.swappiness > 0
This was originally reported against 0.7.0-rc2. Is it still and issue with 0.7.2?
I'm not sure. Since I posted this I doubled the memory in my laptop, and have since bought a new laptop. I rarely swap anymore. FWIW, I had already set swappiness to "0" when this happened, that doesn't change this issue if it still does exist.
I'm still getting this when memory pressure is high and swap is on and lying in the root disk/ZoL --> ZFS 0.7.8.
had to remove swap and/or put in another disk
I was hoping this was behind us, but I had a hang three weeks ago (but couldn't get the logs at the time), and I had another one today. I assume its probably related to memory tuning parameters and my aversion to swap unless absolutely necessary.
https://gist.github.com/bunder2015/e6832aff9528467e5ccf0d288236dc87
vm.swappiness = 1
zfs_arc_max=2147483648 zfs_arc_pc_percent=500
System has 8gb of memory, had 2gb free when I kicked off a firefox upgrade. Typical suspects, firefox, thunderbird, spotify.
Luckily I was able to catch it before the system completely locked up, and I was able to get logs out of it again this time.
does sync=always
really help in the swap on zvol case? is the data not just written to SLOG and then anyhow staying used in ram until the next TXG flush? i.e. sync=always
might just create more work (and latency until the ram can be made available) and hence increase the risk of problems?
FreeBSD recommends: https://wiki.freebsd.org/RootOnZFS#ZFS_Swap_Volume
i believe my thought process was that if you're swapping, you want the data on disk as soon as possible so the memory can be freed, any delay could mean more memory allocation, which you don't have, and you wind up in a situation where you need memory to get data out to swap.
@bunder2015 considering that the SLOG is write only (only read when recovering from a crash), it does not add any real value to write it in the SWAP case, as the data is still in ram until TXG flush.
I consider the FreeBSD recommendations for swap zvol, do be a bit more safe than the zfs on linux recommendations, FreeBSD:
zfs create -V 2G -o org.freebsd:swap=on -o checksum=off -o compression=off -o dedup=off -o sync=disabled -o primarycache=none zroot/swap
The only thing I would probably drop is -o checksum=off
, as that nulls a big part of the reason to use ZFS for swap in Linux. If the server is using ECC memory I do not want to get bit errors in the swap.
Closing as old/stale, I can't easily reproduce without removing half the memory in my laptop
System information
Describe the problem you're observing
I've been testing swap on zvol and was finally able to get a stack trace out of it. My laptop has 4gb of memory, and with firefox, thunderbird and spotify open, I tend to wind up in swap. Sometimes when compiling packages in the background the system will completely hardlock and I'm forced to reboot. ABD helps, but sometimes this still happens. Today my big consumers all froze while compiling packages and for some reason the system was still responsive. The system was roughly 1.2gb into swap when this happened. I don't see anything zfs related on first glance, but if the system is going to give me something, I might as well pass it along. Thanks
Include any warning/errors/backtraces from the system logs