unpack_orig_pfns(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

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:

the page counters, they're iconic:

the free & preallocate squad:

the pack/unpack duo (pack's literally the sibling, go say hi):

the snapshot read/write girlies:


head's up bestie β€” the original page gives no warning about NULL pointers or bad input here, so i'm not gonna invent one πŸ’– just know that bm and zero_bm are expected to be real memory bitmaps, and buf needs 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