On Thu, Feb 13, 2020 at 11:16 PM Chris Murphy <lists@colorremedies.com> wrote:
On Thu, Feb 13, 2020 at 9:32 AM Kamil Paral <kparal@redhat.com> wrote:
>
> On Tue, Feb 11, 2020 at 11:48 PM Chris Murphy <lists@colorremedies.com> wrote:
>> 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@mail.gmail.com/
>
>
> Hmm, what exactly do you want to know? :) Why I use hibernation?

Reproduce steps for hibernation failing. I don't know if it's as easy
as "Launch Firefox, and load 34 pages of bbc.com, then try to
hibernate with 'systemctl hibernate'" - and voila, not enough memory
error.

Yes, in my experience it is that easy. If I look into htop before hibernating and I'm over 50% usage (not counting buffers/cache, I think those get flushed before hibernating), the hibernation doesn't succeed. Often it is just a matter of closing some browser tabs so that I fall under the 50% threshold, and hibernation works fine. I'm sure there has to be some tool to allocate X amount of memory so that this is easier to play with than relying on a web browser, but I don't know it (it should be trivial to write for anyone who knows C, though). But I found out you can use GIMP to upscale an image to a ridiculous size and it will even tell you beforehand in a warning dialog how much memory it will consume. This is what I see if the memory snapshot can't be created (over 50% memory used):

Feb 14 12:03:26 titan systemd[1]: Starting Hibernate...
Feb 14 12:03:26 titan systemd-sleep[3424]: Suspending system...
Feb 14 12:03:26 titan kernel: PM: hibernation entry
Feb 14 12:03:26 titan rtkit-daemon[713]: Successfully made thread 3423 of process 1482 (/usr/bin/pulseaudio) owned by '1000' RT at priority 5.
Feb 14 12:03:26 titan rtkit-daemon[713]: Supervising 4 threads of 2 processes of 1 users.
Feb 14 12:03:28 titan kernel: Filesystems sync: 0.019 seconds
Feb 14 12:03:28 titan kernel: Freezing user space processes ... (elapsed 0.001 seconds) done.
Feb 14 12:03:28 titan kernel: OOM killer disabled.
Feb 14 12:03:28 titan kernel: PM: Marking nosave pages: [mem 0x00000000-0x00000fff]
Feb 14 12:03:28 titan kernel: PM: Marking nosave pages: [mem 0x00058000-0x00058fff]
Feb 14 12:03:28 titan kernel: PM: Marking nosave pages: [mem 0x0009f000-0x000fffff]
Feb 14 12:03:28 titan kernel: PM: Marking nosave pages: [mem 0xca0d8000-0xca0d8fff]
Feb 14 12:03:28 titan kernel: PM: Marking nosave pages: [mem 0xca0e8000-0xca0e9fff]
Feb 14 12:03:28 titan kernel: PM: Marking nosave pages: [mem 0xca106000-0xca106fff]
Feb 14 12:03:28 titan kernel: PM: Marking nosave pages: [mem 0xca66e000-0xca674fff]
Feb 14 12:03:28 titan kernel: PM: Marking nosave pages: [mem 0xcb151000-0xcb6a9fff]
Feb 14 12:03:28 titan kernel: PM: Marking nosave pages: [mem 0xd15c7000-0xd160bfff]
Feb 14 12:03:28 titan kernel: PM: Marking nosave pages: [mem 0xddd9c000-0xdde33fff]
Feb 14 12:03:28 titan kernel: PM: Marking nosave pages: [mem 0xdde80000-0xdf7fefff]
Feb 14 12:03:28 titan kernel: PM: Marking nosave pages: [mem 0xdf800000-0xffffffff]
Feb 14 12:03:28 titan kernel: PM: Basic memory bitmaps created
Feb 14 12:03:28 titan kernel: PM: Preallocating image memory...
Feb 14 12:03:28 titan kernel: PM: Basic memory bitmaps freed
Feb 14 12:03:28 titan kernel: OOM killer enabled.
Feb 14 12:03:28 titan kernel: Restarting tasks ... done.
Feb 14 12:03:28 titan kernel: PM: hibernation exit
Feb 14 12:03:28 titan systemd-sleep[3424]: Failed to suspend system. System resumed again: Cannot allocate memory