alloc_contig_frozen_range(9)
β¨ alloc_contig_frozen_range β¨
okay so bestie, welcome to the alloc_contig_frozen_range page from the Kernel API Manual π
this is a level-9 manpage (9), so it's kernel-internal energy, not your cute little userland command. stay with me, it's gonna slay.
πΈ NAME πΈ
alloc_contig_frozen_range β literally tries to allocate a given range of frozen pages π§β¨
π SYNOPSIS π
int alloc_contig_frozen_range (unsigned long start , unsigned long end ,
acr_flags_t alloc_flags , gfp_t gfp_mask );
that's the whole signature, no cap. four args, one int coming back at you π«Ά
π¦ ARGUMENTS π¦
startβ the start PFN you wanna allocate πendβ the one-past-the-last PFN to allocate, so it's exclusive, iykyk π―alloc_flagsβ the allocation information, aka the vibes you're passing in πgfp_maskβ the GFP mask. important bestie: Node/zone/placement hints are ignored here. Only some action and reclaim modifiers are supported. And those reclaim modifiers? They control allocation behavior during compaction/migration/reclaim. periodt. π
π DESCRIPTION π
okay so first thing's first: the PFN range does not have to be pageblock aligned, which is honestly so chill of it. but β and this is the vibe check β the PFN range must belong to a single zone. one zone. no mixing. π ββοΈ
the very first thing this routine does is attempt to MIGRATE_ISOLATE all pageblocks in the range. once they're isolated, the pageblocks should not be modified by others, like hello, they're in their alone era π§β¨
then all the frozen pages which PFN is in [start, end) are allocated for the caller π and they could be freed with free_contig_frozen_range β and free_frozen_pages also could be used to free compound frozen pages directly. two options, both iconic π
β RETURN β
zero on success π or a negative error code π
π SEE ALSO π
the kernel file ./mm/page_alloc.c and honestly a whole friend group of functions:
__get_pfnblock_flags_mask(9)get_pfnblock_bit(9)get_pfnblock_migratetype(9)__set_pfnblock_flags_mask(9)set_pfnblock_bit(9)clear_pfnblock_bit(9)set_pageblock_migratetype(9)__move_freepages_block_isolate(9)__putback_isolated_page(9)__free_pages(9)free_pages(9)alloc_pages_exact(9)alloc_pages_exact_nid(9)free_pages_exact(9)nr_free_zone_pages(9)nr_free_buffer_pages(9)find_next_best_node(9)free_reserved_pages(9)setup_per_zone_wmarks(9)__free_contig_range(9)alloc_contig_range(9)alloc_contig_frozen_pages(9)alloc_contig_pages(9)free_contig_frozen_range(9)free_contig_range(9)alloc_pages_nolock(9)
π reminder bestie: the PFN range must belong to a single zone. that's not a suggestion, that's the rule.
and that's the page!! huge shoutout to the ./mm directory for hosting this whole situation, and this edition is dated October 2026 ποΈβ¨ mwah, go allocate something 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