try_to_compact_pages(9)
π try_to_compact_pages(9) π
okay so bestie, welcome to the try_to_compact_pages page from the Kernel API Manual β yes it's a section 9 manpage, yes we're doing this, and yes you're gonna get it. π«Ά
β¨ NAME β¨
try_to_compact_pages β Direct compact to satisfy a high-order allocation
like, it goes in and compacts memory directly, no cap, so your high-order allocation can actually happen. π₯
πΈ SYNOPSIS πΈ
enum compact_result try_to_compact_pages (gfp_t gfp_mask , unsigned int
order , unsigned int alloc_flags , const struct alloc_context *ac , enum
compact_priority prio , struct capture_control *capc );
that's the whole signature, copy it exactly, i don't make the rules (i do, but still). π
π ARGUMENTS π
gfp_maskβ the GFP mask of the current allocation. the vibe-check flags, basically. β¨orderβ the order to try to make available. this is the size of the thing you're tryna fit, and it will be judged. πalloc_flagsβ the allocation flags of the current allocation. more flags, more context, we love a fully-specified caller. πΈacβ the context of current allocation. it's aconst struct alloc_context *, so hands off, no touching. πprioβ determines how hard direct compaction should try to succeed. anenum compact_priority, so likeβ¦ how desperate are we. πcapcβ free page capture bypassing the freelist, astruct capture_control *. it's giving sneaky but make it efficient. π
π¦ DESCRIPTION π¦
This is the main entry point for direct page compaction. periodt. that's the whole description and honestly? iconic. it does exactly what it says on the tin β you call it, it compacts, directly. π§
π SEE ALSO π
Kernel file ./mm/compaction.cβ the source, go read it, iykyk πisolate_freepages_range(9)skip_isolation_on_order(9)isolate_migratepages_block(9)isolate_migratepages_range(9)
all of these are your little compaction besties, go say hi. π
ngl if you're here you're probably debugging an allocation failure at like 2am. drink water, bestie. π
that's the whole page!! source is ./mm and it's dated October 2026 β so like, future girlie energy. stay compacted, mwah π
ππ
π¦ 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