folio_split(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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 to list if 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 -ENOMEM is returned, the folio might be split but not to new_order β€” so the caller needs to check. like, actually check. fr fr πŸ’€

🌈 SEE ALSO 🌈

Kernel file ./mm/huge_memory.c, plus all these icons:


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