kernel/power/swap.c
Source file repositories/reference/linux-study-clean/kernel/power/swap.c
File Facts
- System
- Linux kernel
- Corpus path
kernel/power/swap.c- Extension
.c- Size
- 41523 bytes
- Lines
- 1711
- Domain
- Core OS
- Bucket
- Scheduler, Processes, Timers, Sync, And Syscalls
- Inferred role
- Core OS: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
crypto/acompress.hlinux/module.hlinux/file.hlinux/delay.hlinux/bitops.hlinux/device.hlinux/bio.hlinux/blkdev.hlinux/swap.hlinux/swapops.hlinux/pm.hlinux/slab.hlinux/vmalloc.hlinux/cpumask.hlinux/atomic.hlinux/kthread.hlinux/crc32.hlinux/ktime.hpower.h
Detected Declarations
struct swap_map_pagestruct swap_map_page_liststruct swap_map_handlestruct swsusp_headerstruct swsusp_extentstruct hib_bio_batchstruct crc_datastruct cmp_datastruct dec_datafunction low_free_pagesfunction reqd_free_pagesfunction swsusp_extents_insertfunction alloc_swapdev_blockfunction free_all_swap_pagesfunction swsusp_swap_in_usefunction hib_init_batchfunction hib_finish_batchfunction hib_end_iofunction hib_submit_io_syncfunction hib_submit_io_asyncfunction hib_wait_iofunction mark_swapfilesfunction swsusp_swap_checkfunction write_pagefunction release_swap_writerfunction get_swap_writerfunction swap_write_pagefunction flush_swap_writerfunction swap_writer_finishfunction save_imagefunction free_crc_datafunction crc32_threadfnfunction compress_threadfnfunction save_compressed_imagefunction enough_swapfunction syncedfunction release_swap_readerfunction get_swap_readerfunction swap_read_pagefunction swap_reader_finishfunction load_imagefunction decompress_threadfnfunction load_compressed_imagefunction swsusp_readfunction swsusp_checkfunction swsusp_closefunction swsusp_unmarkfunction hibernate_compression_threads_show
Annotated Snippet
core_initcall(swsusp_header_init);
static int __init hibernate_compression_threads_setup(char *str)
{
int rc = kstrtouint(str, 0, &hibernate_compression_threads);
if (rc)
return rc;
if (hibernate_compression_threads < 1)
hibernate_compression_threads = CMP_THREADS;
return 1;
}
__setup("hibernate_compression_threads=", hibernate_compression_threads_setup);
Annotation
- Immediate include surface: `crypto/acompress.h`, `linux/module.h`, `linux/file.h`, `linux/delay.h`, `linux/bitops.h`, `linux/device.h`, `linux/bio.h`, `linux/blkdev.h`.
- Detected declarations: `struct swap_map_page`, `struct swap_map_page_list`, `struct swap_map_handle`, `struct swsusp_header`, `struct swsusp_extent`, `struct hib_bio_batch`, `struct crc_data`, `struct cmp_data`, `struct dec_data`, `function low_free_pages`.
- Atlas domain: Core OS / Scheduler, Processes, Timers, Sync, And Syscalls.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.