include/linux/kho/abi/kexec_handover.h
Source file repositories/reference/linux-study-clean/include/linux/kho/abi/kexec_handover.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/kho/abi/kexec_handover.h- Extension
.h- Size
- 10582 bytes
- Lines
- 290
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source 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.
- 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
linux/bits.hlinux/log2.hlinux/math.hlinux/types.hasm/page.h
Detected Declarations
struct kho_vmalloc_hdrstruct kho_vmalloc_chunkstruct kho_vmallocstruct kho_radix_nodestruct kho_radix_leafenum kho_radix_consts
Annotated Snippet
struct kho_vmalloc_hdr {
DECLARE_KHOSER_PTR(next, struct kho_vmalloc_chunk *);
};
#define KHO_VMALLOC_SIZE \
((PAGE_SIZE - sizeof(struct kho_vmalloc_hdr)) / \
sizeof(u64))
/*
* Each chunk is a single page and is part of a linked list that describes
* a preserved vmalloc area. It contains the header with the link to the next
* chunk and a zero terminated array of physical addresses of the pages that
* make up the preserved vmalloc area.
*/
struct kho_vmalloc_chunk {
struct kho_vmalloc_hdr hdr;
u64 phys[KHO_VMALLOC_SIZE];
};
static_assert(sizeof(struct kho_vmalloc_chunk) == PAGE_SIZE);
/*
* Describes a preserved vmalloc memory area, including the
* total number of pages, allocation flags, page order, and a pointer to the
* first chunk of physical page addresses.
*/
struct kho_vmalloc {
DECLARE_KHOSER_PTR(first, struct kho_vmalloc_chunk *);
unsigned int total_pages;
unsigned short flags;
unsigned short order;
};
/**
* DOC: KHO persistent memory tracker
*
* KHO tracks preserved memory using a radix tree data structure. Each node of
* the tree is exactly a single page. The leaf nodes are bitmaps where each set
* bit is a preserved page of any order. The intermediate nodes are tables of
* physical addresses that point to a lower level node.
*
* The tree hierarchy is shown below::
*
* root
* +-------------------+
* | Level 5 | (struct kho_radix_node)
* +-------------------+
* |
* v
* +-------------------+
* | Level 4 | (struct kho_radix_node)
* +-------------------+
* |
* | ... (intermediate levels)
* |
* v
* +-------------------+
* | Level 0 | (struct kho_radix_leaf)
* +-------------------+
*
* The tree is traversed using a key that encodes the page's physical address
* (pa) and its order into a single unsigned long value. The encoded key value
* is composed of two parts: the 'order bit' in the upper part and the
* 'shifted physical address' in the lower part.::
*
* +------------+-----------------------------+--------------------------+
* | Page Order | Order Bit | Shifted Physical Address |
* +------------+-----------------------------+--------------------------+
* | 0 | ...000100 ... (at bit 52) | pa >> (PAGE_SHIFT + 0) |
* | 1 | ...000010 ... (at bit 51) | pa >> (PAGE_SHIFT + 1) |
* | 2 | ...000001 ... (at bit 50) | pa >> (PAGE_SHIFT + 2) |
* | ... | ... | ... |
* +------------+-----------------------------+--------------------------+
*
* Shifted Physical Address:
* The 'shifted physical address' is the physical address normalized for its
* order. It effectively represents the PFN shifted right by the order.
*
* Order Bit:
* The 'order bit' encodes the page order by setting a single bit at a
* specific position. The position of this bit itself represents the order.
*
* For instance, on a 64-bit system with 4KB pages (PAGE_SHIFT = 12), the
* maximum range for the shifted physical address (for order 0) is 52 bits
* (64 - 12). This address occupies bits [0-51]. For order 0, the order bit is
* set at position 52.
*
* The following diagram illustrates how the encoded key value is split into
* indices for the tree levels, with PAGE_SIZE of 4KB::
*
Annotation
- Immediate include surface: `linux/bits.h`, `linux/log2.h`, `linux/math.h`, `linux/types.h`, `asm/page.h`.
- Detected declarations: `struct kho_vmalloc_hdr`, `struct kho_vmalloc_chunk`, `struct kho_vmalloc`, `struct kho_radix_node`, `struct kho_radix_leaf`, `enum kho_radix_consts`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
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.