My understanding of zram is that what you write to the /dev/zram
device is compressed and stores in a pre-allocated section of RAM. The size listed for the zram is the size pre-allocated in RAM.
The principle of hibernation/suspend-to-disk is that everything in RAM needs to be stored in disk instead. That necessitates the contents of zram being copied out to the swapfile, zram disabled, and then the remaining RAM contents added to the swapfile (effectively). I haven’t heard anyone being capable of writing the compressed zram contents from RAM directly to the swapfile and back.
What may be confusing or misleading is that the default zram and swapfile handling for suspend-to-disk was updated a while ago to transparently handle this zram content copying and disabling (according to something I read somewhere). And if you aren’t using a lot of the zram space, it won’t need that big of a swapfile. However if you don’t make the swapfile big enough for your worst case, you may unexpectedly find hibernate didn’t work or got corrupted (depending on whether you have pre-checking of file size disabled or not).
Maybe I’m mistaken, most of this info is cobbled together and then verified, so it could be there’s no changes for automatic zram disabling and enabling and the swapfile does only need to be the size of RAM. But it would be had to know for sure unless you had a very full zram when trying to hibernate, and the pre-checksnn the swapfile enabled.
I wasn’t aware.of that, though it makes sense. I haven’t encountered anything that mentioned including GPU RAM size in swapfile size calculations before, even when zram isn’t involved.
I don’t have a system with a dGPU, so I don’t have that service. Do you have details on what it’s called that I could look up?