prepare_highmem_image(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– prepare_highmem_image(9) πŸ’–

okay so bestie, welcome to the prepare_highmem_image page from the Kernel API Manual β€” yes that's the manual name, it's giving very serious kernel energy and honestly? iconic. sit down, grab a snack πŸ“, we're learning about allocating memory for loading highmem data from an image. no cap.


✨ NAME ✨

prepare_highmem_image β€” allocate memory for loading highmem data from image. that's it, that's the whole vibe. 🫢


🌸 SYNOPSIS 🌸

int prepare_highmem_image (struct memory_bitmap *bm , unsigned int
*nr_highmem_p );

look at her. so clean. so signature. πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • bm β€” pointer to an uninitialized memory bitmap structure. bestie, note the word uninitialized β€” this is not a "oops I forgot to init it" situation, that's the whole assignment. πŸ‘€
  • nr_highmem_p β€” pointer to the number of highmem image pages. it's a pointer, so it's pointing at the variable holding that count. πŸ¦‹

πŸ”₯ DESCRIPTION πŸ”₯

okay so here's what she does: prepare_highmem_image tries to allocate as many highmem pages as there are highmem image pages. and where does it get that number? nr_highmem_p points to the variable containing the number of highmem image pages. iykyk.

the pages that are "safe" β€” and by "safe" we mean they will not be overwritten when the hibernation image is restored entirely 😭 β€” get the corresponding bits set in bm.

and bm must be uninitialized. literally the requirement. don't come in here with a pre-baked bitmap, that's not the move. πŸ™ˆ


πŸ’€ NOTE πŸ’€

do not call this function if there are no highmem image pages. like, at all. fr fr. this is not a drill, this is the documented note and we respect it. 🚫

🌈 SEE ALSO 🌈

kernel file ./kernel/power/snapshot.c β€” and the whole friend group, all of them, no one gets left out:


and that's the page, bestie β€” you ate that. this one lives under ./kernel/power and it's dated October 2026. mwah πŸ’œβœ¨

πŸ“¦ where this page comes from