largest_zero_folio(9)
π largest_zero_folio(9) π
ok so bestie, welcome to the Kernel API Manual β no cap, this one's a lil niche but she's iconic π
β¨ NAME β¨
largest_zero_folio β literally just get the biggest zero-size folio available, that's the whole gig π
π¦ SYNOPSIS π¦
struct folio *largest_zero_folio (void );
πΈ ARGUMENTS πΈ
voidβ no arguments, not a single one, she takes zero input and we respect that π«Ά
π DESCRIPTION π
okay so here's the vibe: you reach for this function when mm_get_huge_zero_folio is not an option for you β specifically when there's no appropriate mm lifetime to tie the huge zero folio back to the caller. like, there's just nowhere to hang it, yk? so this function is the one you call instead. main character energy tbh π
and a lil PSA: deduce the size of the folio with folio_size instead of assuming the folio size. do not assume. we don't assume here, we check. periodt π
β RETURN β
she gives you back:
- a pointer to a PMD sized zero folio if
CONFIG_PERSISTENT_HUGE_ZERO_FOLIOis enabled, or - a single page sized zero folio
either way you get a zero folio, the size is just a lil surprise depending on config π
π SEE ALSO π
- Kernel file
./include/linux/huge_mm.h thp_vma_allowable_orders(9)pmd_is_huge(9)pud_is_huge(9)folio_test_pmd_mappable(9)
go read those next bestie, iykyk πβ¨
π§ just a reminder:largest_zero_foliois not a swap-in formm_get_huge_zero_folioin every situation β it's the move when there's no appropriatemmlifetime to tie the huge zero folio from the caller. don't be out here using it wrong, fr fr π
k that's the whole page!! shoutout to the kernel source dir ./include/linux, dated October 2026 β she's fresh, she's documented, and she ate ππ bye bestie!! π
π¦ 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