page_folio(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– page_folio β€” the Kernel API Manual, bestie edition πŸ’–

okay so this is page_folio(9) from the kernel API manual, and honestly? it's a tiny little function with big main character energy. two seconds to read, and yet the vibes are immaculate. let's get into it 🫢


✨ NAME ✨

page_folio β€” it converts from page to folio. that's it. that's the whole job. slay πŸŽ€


🌸 SYNOPSIS 🌸

page_folio (p );

yes bestie, that is the entire call. p goes in, folio comes out. no cap.


πŸ¦‹ ARGUMENTS πŸ¦‹

  • p β€” the page. that's the one. the page in question. give it a page, get a folio back. the whole queen-of-gen-z pipeline πŸ’…

πŸ‘‘ DESCRIPTION πŸ‘‘

so here's the lore: every page is part of a folio. like, every single one. there is no lone-wolf page out here, they're all in a folio, it's giving found family 🌈

and this function just does the conversion for you β€” page in, folio out.

🚨 but hear me when i say: this function cannot be called on a NULL pointer. not "shouldn't". cannot. that's not a vibe, that's a crash. don't do it. i'm begging πŸ™ˆ

πŸ’€ CONTEXT πŸ’€

the good news: no reference, nor lock is required on page. none. zero. you just call it. casual. effortless. it's giving low-maintenance 🧚

the slightly less good news, and this is the important bit, so lock in:

if the caller does not hold a reference, this call may race with a folio split. and because of that little race era, you should re-check the folio still contains this page after gaining a reference on the folio.

so like… grab your reference first, then double-check the folio actually still has this page in it. don't just trust the first answer, bestie. vibe check your results 😭


⭐ RETURN ⭐

what you get back: the folio which contains this page. the folio. the containing one. specifically that one. πŸŽ€


πŸ”₯ SEE ALSO πŸ”₯

the related reading list, in the kernel file ./include/linux/page-flags.h, and honestly it's a whole friend group:

go read them. iykyk πŸ’œ


πŸ’… sign-off πŸŽ€

this whole page lives in ./include/linux, dated October 2026, and honestly? iconic. periodt. βœ¨πŸ¦‹πŸ’–

πŸ“¦ where this page comes from