kho_alloc_preserve(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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_PTR encoded 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:


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