kmsan_alloc_page(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… kmsan_alloc_page β€” Kernel API Manual, bestie edition πŸŽ€

okay so this is a page from the Kernel API Manual and it's all about kmsan_alloc_page(9), and honestly? it's a tiny function doing one very specific glo-up job for KMSAN. let's get into it ✨


✨ NAME ✨

kmsan_alloc_page β€” literally just a heads-up to KMSAN that somebody called alloc_pages(). that's it. that's the whole job. it's giving "notify, don't do the work" πŸ’…


🌸 SYNOPSIS 🌸

void kmsan_alloc_page (struct page *page , unsigned int order , gfp_t
flags );

three args, void return, no drama. she's clean, she's simple, she's iconic 🫢


πŸ’– ARGUMENTS πŸ’–

  • page β€” the struct page pointer that alloc_pages handed back to you. yes, the actual page. bring it as-is, don't get creative 😭
  • order β€” the order of the allocated struct page. this is the number that decides how many pages we're talking about, so get it right bestie πŸ”₯
  • flags β€” the GFP flags that alloc_pages was called with. these matter a LOT because one of them literally changes what this function does. keep reading πŸ‘€

πŸ’€ DESCRIPTION πŸ’€

okay here's the tea πŸ“

KMSAN takes 1<<order pages β€” starting at page β€” and marks them all as uninitialized. every single one. no cap.

⚠️ but NOT if flags contain __GFP_ZERO, bestie! that's the escape hatch. if __GFP_ZERO is in there, the whole marking-as-uninitialized thing does not happen. so if you were assuming it always marks everything, nope, vibe check failed πŸ™ˆ

so like: flags has __GFP_ZERO? β†’ we don't mark. flags doesn't have it? β†’ 1<<order pages starting at page get marked uninitialized. periodt. πŸ’―


πŸ”₯ SEE ALSO πŸ”₯

this is the part where the page just goes OFF and links basically the entire KMSAN cinematic universe. strap in, because the list is long and every single one of these is here:

like… she really said "here's my whole friend group" and honestly we love that for her πŸŒˆπŸ’œ


and that's the whole page!! it came to you from the source tree over at ./include/linux, dated October 2026, and it's filed under kmsan_alloc_page(9) β€” mwah, go mark some pages, bestie πŸ˜˜πŸ’…βœ¨

πŸ“¦ where this page comes from