unpack_orig_pfns(9)
unpack_orig_pfns(9) π β¨
okay so bestie, welcome to the kernel API manual β this one's all about unpack_orig_pfns, and honestly? it's giving "underrated little helper" energy. let's get into it π«Ά
β¨ NAME β¨
unpack_orig_pfns β sets the bits corresponding to the given PFNs in a memory bitmap. that's literally the whole vibe, no cap π
π SYNOPSIS π
int unpack_orig_pfns (unsigned long *buf , struct memory_bitmap *bm ,
struct memory_bitmap *zero_bm );
πΈ ARGUMENTS πΈ
bufβ the area of memory containing the PFNs. it's the source data, the main character of this operation πbmβ a memory bitmap. this is where the bits get set, bestie οΏ½οΏ½zero_bmβ a memory bitmap with the zero PFNs marked. it's the special little tracker for the zero-page girlies π
π¦ DESCRIPTION π¦
so here's what's happening, fr fr. for each element of the array pointed to by buf β and we're doing this one page at a time, okay, one at a time, no rushing the process β¨ β we set the corresponding bit in bm.
and if the page was originally populated with only zeros? then a corresponding bit gets set in zero_bm too. it's double duty, and it ate, honestly ππ₯
π§ SEE ALSO π§
okay, this is the extended friend group, so let's introduce everybody π
the kernel file: ./kernel/power/snapshot.c β that's where the magic lives, iykyk
the getters & setters:
the rtree & extent crew:
the bitmap besties:
memory_bm_next_pfn(9)mark_nosave_pages(9)create_basic_memory_bitmaps(9)free_basic_memory_bitmaps(9)
the page counters, they're iconic:
snapshot_additional_pages(9)count_free_highmem_pages(9)count_highmem_pages(9)count_data_pages(9)count_highmem_image_pages(9)
the free & preallocate squad:
swsusp_free(9)preallocate_image_pages(9)free_unnecessary_pages(9)minimum_image_size(9)hibernate_preallocate_memory(9)
the pack/unpack duo (pack's literally the sibling, go say hi):
the snapshot read/write girlies:
snapshot_read_next(9)prepare_highmem_image(9)copy_last_highmem_page(9)prepare_image(9)snapshot_write_next(9)restore_highmem(9)
head's up bestie β the original page gives no warning aboutNULLpointers or bad input here, so i'm not gonna invent one π just know thatbmandzero_bmare expected to be real memory bitmaps, andbufneeds to actually point at PFNs. that's just what the signature is telling you, periodt.
and that's a wrap on unpack_orig_pfns(9), from the ./kernel/power corner of the kernel, dated October 2026 β source/version vibes included because we don't gatekeep π stay hydrated, keep your bitmaps close, and slay your snapshot logic bestie πβπ
π¦ 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