Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Hibernation fails unless 50%+ RAM is available
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Oleg Muraviov
n00b
n00b


Joined: 29 Jun 2011
Posts: 18

PostPosted: Fri Apr 23, 2021 8:44 pm    Post subject: Hibernation fails unless 50%+ RAM is available Reply with quote

Hibernation fails with "Cannot allocate memory" if less then 50% of RAM is available.
It works fine when there is more.

Is it suppose to be so?

Code:
# free
               total        used        free      shared  buff/cache   available
Mem:        16254856     8509796     6030992     1160060     1714068     6258360
Swap:       35651580           0    35651580


Code:
# echo disk > /sys/power/state
bash: echo: write error: Cannot allocate memory


Code:

# dmesg
[ 2118.903705] PM: hibernation: hibernation entry
[ 2118.913749] Filesystems sync: 0.003 seconds
[ 2118.913759] Freezing user space processes ... (elapsed 0.003 seconds) done.
[ 2118.917028] OOM killer disabled.
[ 2118.917153] PM: hibernation: Marking nosave pages: [mem 0x00000000-0x00000fff]
[ 2118.917156] PM: hibernation: Marking nosave pages: [mem 0x0009f000-0x000fffff]
[ 2118.917159] PM: hibernation: Marking nosave pages: [mem 0x8263c000-0x8263cfff]
[ 2118.917160] PM: hibernation: Marking nosave pages: [mem 0x82668000-0x82668fff]
[ 2118.917161] PM: hibernation: Marking nosave pages: [mem 0x85dc9000-0x85dc9fff]
[ 2118.917162] PM: hibernation: Marking nosave pages: [mem 0x85dd9000-0x85dd9fff]
[ 2118.917163] PM: hibernation: Marking nosave pages: [mem 0x85e65000-0x85e6afff]
[ 2118.917164] PM: hibernation: Marking nosave pages: [mem 0x8b198000-0x8ba97fff]
[ 2118.917196] PM: hibernation: Marking nosave pages: [mem 0x99cae000-0x9bb4dfff]
[ 2118.917304] PM: hibernation: Marking nosave pages: [mem 0x9bb4f000-0xffffffff]
[ 2118.918481] PM: hibernation: Basic memory bitmaps created
[ 2118.918925] PM: hibernation: Preallocating image memory
[ 2120.920015] PM: hibernation: Image allocation is 456166 pages short
[ 2121.067453] acpi LNXPOWER:05: Turning OFF
[ 2121.067472] acpi LNXPOWER:00: Turning OFF
[ 2121.067555] PM: hibernation: Basic memory bitmaps freed
[ 2121.067557] OOM killer enabled.
[ 2121.067557] Restarting tasks ... done.
[ 2121.070020] PM: hibernation: hibernation exit


Code:
#uname -a
Linux mi 5.11.12-gentoo-x86_64 #1 SMP Fri Apr 23 08:07:54 EEST 2021 x86_64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz GenuineIntel GNU/Linux
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3879

PostPosted: Fri Apr 23, 2021 9:48 pm    Post subject: Reply with quote

Do you have a
Code:

resume=UUID=<uuid-of-swap-partition>

in linux line in
/etc/default/grub
?
Maybe it helps.......
_________________
:)
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 21771

PostPosted: Fri Apr 23, 2021 10:09 pm    Post subject: Reply with quote

Oleg Muraviov wrote:
Hibernation fails with "Cannot allocate memory" if less then 50% of RAM is available.
It works fine when there is more.

Is it suppose to be so?
According to the kernel documentation, yes.
Documentation/power/pci.rst:
The freezing of devices is carried out after enough memory has been freed (at
the time of this writing the image creation requires at least 50% of system RAM
to be free) in the following three phases:
alamahant wrote:
Do you have a
Code:

resume=UUID=<uuid-of-swap-partition>

in linux line in
/etc/default/grub
?
Maybe it helps.......
Why do you think this is applicable? OP already stated that it works if sufficient RAM is free.
Back to top
View user's profile Send private message
Oleg Muraviov
n00b
n00b


Joined: 29 Jun 2011
Posts: 18

PostPosted: Sat Apr 24, 2021 2:49 am    Post subject: Reply with quote

alamahant, there are no problems with basic configuration. It works in general.

Hu wrote:
According to the kernel documentation, yes.

Thanks..
Are there any workarounds? )
Compressed RAM, I don't know, some userspace tools for hibernation? Is it possible to write an image directly to a disk instead of pre-creating it in RAM?
At least fallback to suspend to RAM?

Upd: looks like it could work, but I can't find any tunings for it to work
https://01.org/linuxgraphics/gfx-docs/drm/power/swsusp.html wrote:
Q:
If my application(s) causes lots of memory & swap space to be used (over half of the total system RAM), is it correct that it is likely to be useless to try to suspend to disk while that app is running?
A:
No, it should work okay, as long as your app does not mlock() it. Just prepare big enough swap partition.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum