kho_alloc_preserve(9)
β¨ NAME β¨
kho_alloc_preserve β bestie, this is the one that allocates, zeroes, and preserves memory. All three. At once. Iconic behaviour honestly π
(also hi, you're in section 9, the Kernel API Manual β the fun section π)
πΈ SYNOPSIS πΈ
void * kho_alloc_preserve (size_t size );
π¦ ARGUMENTS π¦
sizeβ the number of bytes you wanna allocate. that's it. that's the whole vibe. β¨
π DESCRIPTION π
okay so picture this: you ask for some memory, and it allocates a physically contiguous block of zeroed pages that's big enough to hold size bytes. zeroed. already clean. no leftover crumbs from whoever used it before. we love a fresh start π«Ά
then β and this is the main character moment β that allocated memory gets registered with KHO for preservation across a kexec. so like, it survives the handover. it's giving survivor energy. it does not get left behind ππ₯
π NOTE π
heads up bestie, the actual allocated size will be rounded up to the nearest power-of-two page boundary. so don't come for it if you asked for a weird number and got a rounder one. that's just how it is π
and the return value, since obviously you're wondering:
- return β on success you get a virtual pointer to the allocated and preserved memory. slay. β
- on failure? you get an
ERR_PTRencoded error. so check it before you go dereferencing like it's nothing, ok? π
π SEE ALSO π
the kernel file itself lives at ./kernel/liveupdate/kexec_handover.c β go read it, iykyk π
and here's the whole squad, no cap, every single one:
kho_encode_radix_key(9)kho_decode_radix_key(9)kho_radix_add_key(9)kho_radix_del_key(9)kho_radix_init_tree(9)kho_radix_destroy_tree(9)kho_radix_walk_tree(9)kho_restore_folio(9)kho_restore_pages(9)kho_reserve_scratch(9)kho_add_subtree(9)kho_preserve_folio(9)kho_unpreserve_folio(9)kho_preserve_pages(9)kho_unpreserve_pages(9)kho_preserve_vmalloc(9)kho_unpreserve_vmalloc(9)kho_restore_vmalloc(9)kho_unpreserve_free(9)kho_restore_free(9)is_kho_boot(9)kho_retrieve_subtree(9)
mwah π this lil page came to you straight from ./kernel/liveupdate, dated October 2026, and it's kho_alloc_preserve(9) forever and always. go touch some pages (the zeroed, preserved kind). periodt. β
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms