I want my computer to automatically hibernate when the UPS switches to the battery, so I need enough free swap space at any moment. But if I activate the swap partition, even right before the hibernation, it can be occupied by memory pages.
The only solution I found is to set /proc/sys/vm/swappiness
to 0
and disable paging completely. But it's not the best option.
Is it possible to specify maximum swap usage in bytes?