The author dives into the intricate details of how Linux moves from an awake to a hibernating state and restores all state. The investigation is split into various parts, with the first part focusing on filesystem synchronization when invoking hibernation. The system files /sys/power/state and /sys/power/disk allow debugging hibernation. An interesting autosleep system originally from Android is discussed, along with the steps of hibernation, including hibernation kernel config, availability checks, compression support, lock acquisition, and handling gfp masks. Controversially, sleep flags and console preparation during hibernation are also explored.
https://tookmund.com/2024/09/hibernation-preparation