Documentation/power/swsusp.rst
Source file repositories/reference/linux-study-clean/Documentation/power/swsusp.rst
File Facts
- System
- Linux kernel
- Corpus path
Documentation/power/swsusp.rst- Extension
.rst- Size
- 18419 bytes
- Lines
- 504
- Domain
- Support Tooling And Documentation
- Bucket
- Documentation
- Inferred role
- Support Tooling And Documentation: documentation
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
============
Swap suspend
============
Some warnings, first.
.. warning::
**BIG FAT WARNING**
If you touch anything on disk between suspend and resume...
...kiss your data goodbye.
If you do resume from initrd after your filesystems are mounted...
...bye bye root partition.
[this is actually same case as above]
If you have unsupported ( ) devices using DMA, you may have some
problems. If your disk driver does not support suspend... (IDE does),
it may cause some problems, too. If you change kernel command line
between suspend and resume, it may do something wrong. If you change
your hardware while system is suspended... well, it was not good idea;
but it will probably only crash.
( ) suspend/resume support is needed to make it safe.
If you have any filesystems on USB devices mounted before software suspend,
they won't be accessible after resume and you may lose data, as though
you have unplugged the USB devices with mounted filesystems on them;
see the FAQ below for details. (This is not true for more traditional
power states like "standby", which normally don't turn USB off.)
Swap partition:
You need to append resume=/dev/your_swap_partition to kernel command
line or specify it using /sys/power/resume.
Swap file:
If using a swapfile you can also specify a resume offset using
resume_offset=<number> on the kernel command line or specify it
in /sys/power/resume_offset.
After preparing then you suspend by::
echo shutdown > /sys/power/disk; echo disk > /sys/power/state
- If you feel ACPI works pretty well on your system, you might try::
echo platform > /sys/power/disk; echo disk > /sys/power/state
- If you would like to write hibernation image to swap and then suspend
to RAM (provided your platform supports it), you can try::
echo suspend > /sys/power/disk; echo disk > /sys/power/state
- If you have SATA disks, you'll need recent kernels with SATA suspend
support. For suspend and resume to work, make sure your disk drivers
are built into kernel -- not modules. [There's way to make
suspend/resume with modular disk drivers, see FAQ, but you probably
should not do that.]
If you want to limit the suspend image size to N bytes, do::
echo N > /sys/power/image_size
before suspend (it is limited to around 2/5 of available RAM by default).
- The resume process checks for the presence of the resume device,
if found, it then checks the contents for the hibernation image signature.
If both are found, it resumes the hibernation image.
Annotation
- Atlas domain: Support Tooling And Documentation / Documentation.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.