folio_split(9)
π folio_split(9) π
okay so this is from the Kernel API Manual bestie, and it's genuinely giving main character energy β we're splitting folios today π₯
β¨ NAME β¨
folio_split β split a folio at @split_at to a @new_order folio π
π¦ SYNOPSIS π¦
int folio_split (struct folio *folio , unsigned int new_order , struct
page *split_at , struct list_head *list );
like, yes, that's the whole signature, no cap π
πΈ ARGUMENTS πΈ
folioβ the folio you're splitting, bestie. this is the one.new_orderβ the order of the new folio β¨split_atβ a page within the new folio. that's where the split happens, periodt.listβ after-split folios get added tolistif it's not null; otherwise they go to the LRU list. iykyk π«Ά
π DESCRIPTION π
okay so real talk β it has the same prerequisites and returns as split_huge_page_to_list_to_order. not me just pointing you at that instead of explaining, but that's literally what the manpage says so π
So what does it actually do? It splits a folio at split_at into a new_order folio, and β this is the iconic part β it leaves the remaining subpages of the original folio as large as possible π
Let's do the example, because the example eats:
split an order-9 folio at its third order-3 subpages to an order-3 folio. There are 2^(9-3)=64 order-3 subpages in the order-9 folio. After the split, you get a group of folios with different orders, and the new folio containing split_at is marked in brackets:
[order-4, {order-3}, order-3, order-5, order-6, order-7, order-8]
see the {order-3} in there? that's the one. slay π
important bestie: after split, folio is left locked for the caller. don't forget to unlock it, i'm begging you π
β RETURN β
0β successful π<0β failed.
and here's the caveat, listen up: if-ENOMEMis returned, the folio might be split but not tonew_orderβ so the caller needs to check. like, actually check. fr fr π
π SEE ALSO π
Kernel file ./mm/huge_memory.c, plus all these icons:
vmf_insert_pfn_pmd(9)vmf_insert_pfn_pud(9)vmf_insert_folio_pud(9)touch_pmd(9)zap_huge_pmd(9)__split_unmapped_folio(9)folio_check_splittable(9)__folio_split(9)folio_split_unmapped(9)min_order_for_split(9)
anyway that's the whole page bestie, go split some folios responsibly π§
sign-off time: this little gem lives in ./mm and it's dated October 2026 β so yeah, it's from the future and it's still iconic πβ¨
π¦ 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