On Fri, Sep 14, 2018 at 9:16 AM, Ray Strode <rstrode(a)redhat.com> wrote:
On Fri, Sep 14, 2018 at 11:09 AM, Bastien Nocera <bnocera(a)redhat.com> wrote:
>> The kernel shouldn't be exposing features it can't reliably provide.
>> Again, as I understand it, it's not even a hardware-supported situation, it
>> potentially fail on *any system* if the swap partition is filled up
>> the wrong way,
>> if i'm not mistaken.
> There's multiple levels of "support". The kernel doesn't know if it
> swap, this is checked by user-space, systemd in this case.
But that's bonkers, there's no way systemd can know either.
The only way to make this reliable is if the kernel has a dedicated hibernate
partition the same size as ram that doesn't get used for anything but
systemd knows what the kernel knows, cat /proc/meminfo - which
includes what part of swap is used for swap, and what's needed for a
hibernation image, and therefore if there's enough space on swap for
both swap and hibernation to co-exist. I don't know if systemd uses
any of the kernel test facilities in advance for things like whether
all tasks are freezeable, whether any connected devices will prevent
hibernation, and so on.
The used to be some unused code in the installer, regarding
partitioning for hibernation support, and I vaguely recall for most
configurations it wanted double the amount of memory because it was
conceivable the hibernation image would be the same size as RAM, and
also it was desirable to fully utilize swap. Seems like that could be
1.25x RAM, expecting to swap out no more than 1/4, and possibly need a
1:1 RAM to hibernation image ratio.
Anyway if you tell the kernel to hibernate, I think it tries to
hibernate. Whereas systemd will advert to user space that hibernation
isn't possible if it thinks it isn't possible, due to memory and swap