page_folio(9)
π 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:
folio_page(9)folio_xor_flags_has_waiters(9)folio_test_uptodate(9)folio_test_large(9)PageHuge(9)page_has_movable_ops(9)folio_has_private(9)
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
- 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