All of lore.kernel.org
 help / color / mirror / Atom feed
* re: is hibernation usable?
@ 2020-02-11 19:50 Chris Murphy
  2020-02-11 22:23 ` Luigi Semenzato
  0 siblings, 1 reply; 27+ messages in thread
From: Chris Murphy @ 2020-02-11 19:50 UTC (permalink / raw)
  To: linux-mm; +Cc: semenzato

Original thread:
https://lore.kernel.org/linux-mm/CAA25o9RSWPX8L3s=r6A+4oSdQyvGfWZ1bhKfGvSo5nN-X58HQA@mail.gmail.com/

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.

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 device

This suggests a 26G-34G swap device, correct? (I realize that this
swap device could, in another example, contain more than 2G of page
outs already, and that would only increase this requirement.)

Is there now (or planned) an automatic kernel facility that will do
the eviction automatically, to free up enough memory, so that the
hibernation image can always be successfully created in-memory? If
not, does this suggest some facility needs to be created, maybe in
systemd, coordinating with the desktop environment? I don't need to
understand the details but I do want to understand if this exists,
will exist, and where it will exist.

One idea floated on Fedora devel@ a few months ago by a systemd
developer, is to activate a swap device at hibernation time. That way
the system is constrained to a smaller swap device, e.g. swap on
/dev/zram during normal use, but can still hibernate by activating a
suitably sized swap device on-demand. Do you anticipate any problems
with this idea? Could it be subject to race conditions?

Is there any difference in hibernation reliability between swap
partitions, versus swapfiles? I note there isn't a standard interface
for all file systems, notably Btrfs has a unique requirement [1]

Are there any prospects for signed hibernation images, in order to
support hibernation when UEFI Secure Boot is enabled?

What about the signing of swap? If there's a trust concern with the
hibernation image, and I agree that there is in the context of UEFI
SB, then it seems there's likewise a concern about active pages in
swap. Yes? No?


[1]
https://lore.kernel.org/linux-btrfs/CAJCQCtSLYY-AY8b1WZ1D4neTrwMsm_A61-G-8e6-H3Dmfue_vQ@mail.gmail.com/

Thanks!

--
Chris Murphy


^ permalink raw reply	[flat|nested] 27+ messages in thread
* is hibernation usable?
@ 2019-10-22 20:09 Luigi Semenzato
  2019-10-22 20:57 ` Rafael J. Wysocki
  0 siblings, 1 reply; 27+ messages in thread
From: Luigi Semenzato @ 2019-10-22 20:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Linux PM, Andrew Morton, Geoff Pike, Bas Nowaira,
	Rafael J. Wysocki, Sonny Rao, Brian Geffon

Following a thread in linux-pm
(https://marc.info/?l=linux-mm&m=157012300901871) I have some issues
that may be of general interest.

1. To the best of my knowledge, Linux hibernation is guaranteed to
fail if more than 1/2 of total RAM is in use (for instance, by
anonymous pages).  My knowledge is based on evidence, experiments,
code inspection, the thread above, and a comment in
Documentation/swsusp.txt, copied here:

 "Instead, we load the image into unused memory and then atomically
copy it back to it original location. This implies, of course, a
maximum image size of half the amount of memory."

2. There's no simple/general workaround.  Rafael suggested on the
thread "Whatever doesn't fit into 50% of RAM needs to be swapped out
before hibernation".  This is a good suggestion: I am actually close
to achieving this using memcgroups, but it's a fair amount of work,
and a fairly special case.  Not everybody uses memcgroups, and I don't
know of other reliable ways of forcing swap from user level.

3. A feature that works only when 1/2 of total RAM can be allocated
is, in my opinion, not usable, except possibly under special
circumstances, such as mine. Most of the available articles and
documentation do not mention this important fact (but for the excerpt
I mentioned, which is not in a prominent position).

Two questions then:

A. Should the documentation be changed to reflect this fact more
clearly?  I feel that the current situation is a disservice to the
user community.

B. Would it be worthwhile to improve the hibernation code to remove
this limitation?  Is this of interest to anybody (other than me)?

Thank you in advance!

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2020-02-27  6:44 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-11 19:50 is hibernation usable? Chris Murphy
2020-02-11 22:23 ` Luigi Semenzato
2020-02-20  2:54   ` Chris Murphy
2020-02-20  2:56     ` Chris Murphy
2020-02-20 17:16       ` Luigi Semenzato
2020-02-20 17:38         ` Luigi Semenzato
2020-02-21  8:49           ` Michal Hocko
2020-02-21  9:04             ` Rafael J. Wysocki
2020-02-21  9:04               ` Rafael J. Wysocki
2020-02-21  9:36               ` Michal Hocko
2020-02-21 17:13                 ` Luigi Semenzato
2020-02-21 17:13                   ` Luigi Semenzato
2020-02-21  9:46               ` Chris Murphy
2020-02-21  9:46                 ` Chris Murphy
2020-02-20 19:09         ` Chris Murphy
2020-02-20 19:44           ` Luigi Semenzato
2020-02-20 21:48             ` Chris Murphy
2020-02-20 21:48               ` Chris Murphy
2020-02-27  6:43             ` Chris Murphy
2020-02-27  6:43               ` Chris Murphy
  -- strict thread matches above, loose matches on Subject: below --
2019-10-22 20:09 Luigi Semenzato
2019-10-22 20:57 ` Rafael J. Wysocki
2019-10-22 21:26   ` Luigi Semenzato
2019-10-22 22:13     ` Rafael J. Wysocki
2019-10-22 22:53       ` Luigi Semenzato
2019-10-22 23:16         ` Rafael J. Wysocki
2019-10-22 23:25           ` Luigi Semenzato

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.