__folio_split(9)
π
__folio_split β the Kernel API Manual girlie is here to explain it β¨
okay so bestie, this is __folio_split(9) from the Kernel API Manual, and it's literally the function that splits a folio at @split_at down to a @new_order folio. icon behavior. let's get into it π«Ά
πΈ SYNOPSIS πΈ
int __folio_split (struct folio *folio , unsigned int new_order , struct
page *split_at , struct page *lock_at , struct list_head *list , enum
split_type split_type );
π ARGUMENTS π
folioβ the folio you're splitting, bestie. that's the main character πnew_orderβ the order of the new folio (yes it's anunsigned int, no we're not debating it)split_atβ a page within the new folio πlock_atβ a page withinfoliothat gets left locked for the caller πlistβ after-split folios get put on it, but only if it's non-NULLπ§Ίsplit_typeβ tells it whether to do a uniform split or not (not uniform = the non-uniform split) π
β¨ DESCRIPTION β¨
So it calls __split_unmapped_folio to actually perform the uniform and non-uniform split. it's also the one in charge of checking whether the split is even supported or not, and of preparing the folio for __split_unmapped_folio. basically it's the responsible friend of the group chat π«‘
After splitting, the after-split folio containing lock_at stays locked, and all the others get unlocked. and that looks like:
- for uniform split,
lock_atpoints to one offolio's subpages π - for buddy allocator like (non-uniform) split,
lock_atpoints tofolioitself π
π₯ RETURN π₯
0β successful, slay π<0β failed π (and if-ENOMEMis returned, the folio might be split but not tonew_orderβ so the caller needs to check, no cap, do not skip this)
β οΈ fr fr: that -ENOMEM case is giving "partial success but make it stressful" β the caller has to check. don't just assume.
π¦ SEE ALSO π¦
Kernel file ./mm/huge_memory.c β plus 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_unmapped(9)folio_split(9)min_order_for_split(9)
aaaand that's the page π it lives in ./mm and the version/date stamp on this one is October 2026 β so future-core of it, honestly. mwah, go split some folios responsibly ππ
π¦ 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