-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hibernation really not possible? #85
Comments
@TeslaBargain, some kind of black voodoo magic. Of course that possible to make it on your own - so you can do it your self. For zram, you need make all that things happen before hibernation:
And that will only work on fs which support that kind of swap files, i.e. for btrfs that not possible. |
@nefelim4ag, thanks for letting me know, so overall too much work to make it worth it. With an out-of-the box solution I'd use it, but that way I'll just stick to my swap partition and regular swap + hibernation use. |
What if there was an option to format & swapon enough swap files for the system to hibernate all its available memory when systemd-swap starts up? and perform That way, the only real lag would be in swapping out zram, something that's just an inevitable part of using zram. The way I figure it, if you're already going to pre-allocate swap at startup, you might as well allocate enough to be useful. |
Hi. I'm willing to know if the scenario where you define a swap partition at installation and use that one for hibernation (not sure how to indicate kernel to use that only for hibernate) and then using zram for the rest of swap operations (and gain in performances). Is it something to consider? Any thoughts? EDIT: this https://gist.github.com/klingtnet/c972b8182e4e2818d6d551b0cbeac44b |
I think one can achieve this through swap priorities + hooks for systemd hibernation. Quickly scouring various stackoverflow questions didn't answer this so I'd have to manually test it. This is actually a much easier fix than the one that I was thinking for and therefore might get implemented prior to 5.0 (although the full fix should be in 5.0) |
IIRC, hibernation requires a single swap device, so it must be large enough to store all allocated memory in RAM/swap elsewhere? (but this hibernation image that is written should by default be using compression with a target of around 40%). I have not attempted such myself, does hibernation not retain the swap files on disk or zram device(s) in RAM as if those were allocated like any other software? You're resuming a system state, so long as the memory is written into the hibernation image it should restore/resume the previous assigned swap devices instead of having to initialize them like a fresh boot would? Thus no swap off/on should be required beyond toggling a hibernation swap device? I've only ever hibernated with a single swap device (no zswap or zram). I am not sure what happens to disk swap (as in more than one swap device exists) in that case (if it needs to fit into the hibernation image, that'd seem redundant?), likewise I assume zram would have it's allocated memory written to the hibernation image like any other memory allocated by software, not sure how the swap part is handled, if additional swap devices need to be written into the hibernation image, then I guess zram and the cache of zswap in RAM would decompress and upon resume need to be recompressed. I'm not able to test the scenario atm to know what happens. Probably not too difficult to test via VM? Worth noting, most distros that are using systemd should defer hibernation to Again, not something I've tested yet to verify. |
Upstream tracking issue: systemd/systemd#16708 |
Obviously hibernation using a swap file instead of a partition is possible. A solution with zram for regular swap and a swap file for hibernation would be desirable.
So what kind of magic would be required to make it work?
The text was updated successfully, but these errors were encountered: