On Mon, Feb 10, 2020 at 4:28 pm, Kamil Paral <kparal(a)redhat.com> wrote:
Actually, as I learned recently, you can't hibernate if you use
occupy than 50% of total memory, it will fail with "can't allocate
memory" error. The reason, at least what I found out, is that the
kernel first copies the whole memory into your memory (ouch), before
writing it to the swap partition. So if you have 16 GB RAM, you can't
hibernate if you use more than 8 GB, and therefore an 8 GB swap
partition (fully unoccupied) is enough for you. I have tested this
multiple times, it works for me exactly as written. So, actually, a
swap device sized 1:1 with RAM is already an overkill (unless you use
more than 50% of swap size with just regular usage), and 0.5:1 ratio
would be perfectly fine if you made sure that swap got used just for
hibernation.
Seems like case in point for why we do not (and should not) support
hibernation.