Re: Support for hibernation 2/2: questions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Tue, Feb 11, 2020 at 3:00 AM Kamil Paral <kparal@xxxxxxxxxx> wrote:
>
> On Mon, Feb 10, 2020 at 9:43 PM Chris Murphy <lists@xxxxxxxxxxxxxxxxx> wrote:
>>
>> Where I came up with 2:1 is from anaconda/blivet code:
>> anaconda/pyanaconda/storage/utils.py:642:    :param bool hibernation:
>> calculate swap size big enough for hibernation
>> https://github.com/rhinstaller/anaconda/blob/master/pyanaconda/storage/utils.py#L654
>>
>> Note on line 673 it actually could be 3x RAM, if --hibernation were
>> used, but this flag isn't used on Fedora Workstation so this
>> computation never gets used.
>
>
> I  guess that's because if you search the Internets, the swap recommendations are all over the place, so some median numbers were picked :-) I had no idea about the hibernation limitation either, until the web browsers started to eat 4+GBs RAM... :-)
>
> The problem is that you don't know how much swap the system will use during regular usage, so you don't know how much headroom you need on top of the 0.5x mem size needed for hibernation. I think nowadays a new formula could be devised, something like `swap size = 0.5x mem size + 2 GB`. I think that's plenty for regular usage (even SSDs are too slow to be used as RAM, not to mention it will wear them out quickly) and it should allow for hibernation most of the time.

I don't think that's enough to be reliable.

Example system: 32G RAM, all of it used, plus 2G of page outs (into
the swap device).

+ 2G already paged out to swap
+ 16GB needs to be paged out to swap, to free up enough memory to
create the hibernation image
+ 8-16GB for the (compressed) hibernation image to be written to a
*contiguous* range within swap

That's 26-34G needed for the swap device. Since the swap device is
shared for pages and hibernation image, the actual size isn't knowable
until the approximate time hibernation is called.

As Bastien noted in the pagure/workstation issue:
https://pagure.io/fedora-workstation/issue/121#comment-620831

I've started a followup thread upstream to get more information about
all of this. Kamil, can you do a brief write up of your use case or
reproduce steps? I want upstream to know that your case is real world,
and not some already known contrived case. You can either reply here
and I'll reference it on linux-mm@ or you can post directly to this
thread if you prefer. Thanks.

https://lore.kernel.org/linux-mm/CAA25o9TvFMEJnF45NFVqAfdxzKy5umzHHVDs+SCxrChGSKczTw@xxxxxxxxxxxxxx/



>> And yet there is a 'resume=UUID' boot
>> parameter included. Why is this boot parameter set as if we're
>> supporting hibernation out of the box?
>
>
> Probably because of this?
> https://bugzilla.redhat.com/show_bug.cgi?id=1206936
> https://github.com/rhinstaller/anaconda/pull/1360

Right but anaconda is not called with --hibernation is what I mean.
The higher partition requirements for hibernation are tied to the
--hibernation flag, but the resume= boot parameter insertion is not.
And it seems to me those things should be tied to --hibernation, and
then also whether --hibernation is used should be an edition specific
decision, and that it should be explicit because otherwise we're just
setting users up for misadventure.


> And yes, we currently support hibernation out of the box, and it works. If you don't have SecureBoot enabled, and if you use non-GNOME or know how to call it from GNOME.

It definitely doesn't work in all cases, and we don't have any
evidence that it works in most cases. I have a laptop that 100% of the
time fails to resume from hibernation because the hibernation image is
considered corrupt by the kernel. I don't know if it's corrupt during
image write out, or read in. S4 relies on ACPI, and isn't even
reliable on Windows or macOS 100% of the time. And as you've
experienced, S3 isn't certainly reliable.

Whereas S0 low power mode is reliable, which is why so much effort is
going there. Just leave ACPI and the (logic board) firmware out of
consideration.

I would rather hibernation work. But I don't think it's OK to, by
default, create huge swap partitions when this very clearly is not at
all reliable as evidenced by your own experience, which requires
either luck or esoteric knowledge to get the active page amount below
some ~50% threshold in order for hibernation image creation to
succeed.


--
Chris Murphy
_______________________________________________
desktop mailing list -- desktop@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to desktop-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/desktop@xxxxxxxxxxxxxxxxxxxxxxx




[Index of Archives]     [Fedora Users]     [Fedora KDE]     [Fedora Announce]     [Fedora Docs]     [Fedora Config]     [PAM]     [Red Hat Development]     [Red Hat 9]     [Gimp]     [Yosemite News]

  Powered by Linux