Re: is hibernation usable?

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

 



On Tue, Feb 11, 2020 at 3:23 PM Luigi Semenzato <semenzato@xxxxxxxxxx> wrote:
>
> On Tue, Feb 11, 2020 at 11:50 AM Chris Murphy <lists@xxxxxxxxxxxxxxxxx> wrote:
> >
> > Original thread:
> > https://lore.kernel.org/linux-mm/CAA25o9RSWPX8L3s=r6A+4oSdQyvGfWZ1bhKfGvSo5nN-X58HQA@xxxxxxxxxxxxxx/
> >
> > This whole thread is a revelation. I have no doubt most users have no
> > idea that hibernation image creation is expected to fail if more than
> > 50% RAM is used. Please bear with me while I ask some possibly
> > rudimentary questions to ensure I understand this in simple terms.
>
> To be clear, I am not completely sure of this.  Other developers are
> not in agreement with this (as you can see from the thread).  However,
> I can easily and consistently reproduce the memory allocation failure
> when anon is >50% of total.  According to others, the image allocation
> should reclaim pages by forcing anon pages to swap.  I don't
> understand if/how the swap partition accommodates both swapped pages
> and the hibernation image, but in any case, in my experiments, I
> allocate a swap disk the same size of RAM, which should be sufficient
> (again, according to the threads).

I'm testing with this method:

# echo reboot > /sys/power/disk
# echo disk > /sys/power/state

About 2/3rd of the time on a test system, hibernation entry fails.
It's fatal. The last journal entry is:
[  349.732372] PM: hibernation: hibernation entry

Screen is blank, system gets hot, fans go to high, and it doesn't
recover after 15 minutes. After forcing power off and rebooting, there
is no hibernation signature reported in the swap partition so I don't
think the kernel every reached reboot.

Shifting over to a qemu-kvm with pm support enabled, this is working.
If I fill up pretty much all of RAM and a small amount of swap is
used, the above two commands succeed, the VM reboots, and the
hibernation image is resumed without error. AnonPages is 73% of total.
Upon successful resume, it appears quite a lot of pages were pushed to
swap. It looks like about 1GiB was paged out.

Before hibernation:
$ cat /proc/meminfo
MemTotal:        2985944 kB
MemFree:          148376 kB
MemAvailable:     220428 kB
Buffers:             172 kB
Cached:           366100 kB
SwapCached:         4632 kB
Active:          1962088 kB
Inactive:         592576 kB
Active(anon):    1842560 kB
Inactive(anon):   467904 kB
Active(file):     119528 kB
Inactive(file):   124672 kB
Unevictable:        1628 kB
Mlocked:            1628 kB
SwapTotal:       3117052 kB
SwapFree:        2899952 kB
Dirty:              6248 kB
Writeback:             0 kB
AnonPages:       2187236 kB
Mapped:           245800 kB
Shmem:            120504 kB
KReclaimable:      58016 kB
Slab:             203260 kB
SReclaimable:      58016 kB
SUnreclaim:       145244 kB
KernelStack:       13712 kB
PageTables:        23364 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     4610024 kB
Committed_AS:    6019396 kB
VmallocTotal:   34359738367 kB
VmallocUsed:       27528 kB
VmallocChunk:          0 kB
Percpu:             4016 kB
HardwareCorrupted:     0 kB
AnonHugePages:         0 kB
ShmemHugePages:        0 kB
ShmemPmdMapped:        0 kB
FileHugePages:         0 kB
FilePmdMapped:         0 kB
CmaTotal:              0 kB
CmaFree:               0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
Hugetlb:               0 kB
DirectMap4k:      238332 kB
DirectMap2M:     2904064 kB


After resume:
[chris@vm ~]$ cat /proc/meminfo
MemTotal:        2985944 kB
MemFree:         1007132 kB
MemAvailable:    1069576 kB
Buffers:              76 kB
Cached:           400464 kB
SwapCached:       296112 kB
Active:           755856 kB
Inactive:         955624 kB
Active(anon):     731668 kB
Inactive(anon):   683352 kB
Active(file):      24188 kB
Inactive(file):   272272 kB
Unevictable:        1632 kB
Mlocked:            1632 kB
SwapTotal:       3117052 kB
SwapFree:        1874788 kB
Dirty:              2716 kB
Writeback:             0 kB
AnonPages:       1182108 kB
Mapped:           225352 kB
Shmem:            102480 kB
KReclaimable:      48968 kB
Slab:             183104 kB
SReclaimable:      48968 kB
SUnreclaim:       134136 kB
KernelStack:       14000 kB
PageTables:        22924 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     4610024 kB
Committed_AS:    5937732 kB
VmallocTotal:   34359738367 kB
VmallocUsed:       27800 kB
VmallocChunk:          0 kB
Percpu:             4016 kB
HardwareCorrupted:     0 kB
AnonHugePages:         0 kB
ShmemHugePages:        0 kB
ShmemPmdMapped:        0 kB
FileHugePages:         0 kB
FilePmdMapped:         0 kB
CmaTotal:              0 kB
CmaFree:               0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
Hugetlb:               0 kB
DirectMap4k:      238332 kB
DirectMap2M:     2904064 kB
$

There must be some other cause for the 50% limitation. Is it possible
it only starts once there's a certain amount of RAM present? e.g.
maybe it can only page out 4GiB of Anon pages to swap? And after that
point if at least 50% RAM isn't available, hibernation image creation
fails?


-- 
Chris Murphy




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux