alloc_contig_range(9)
π§ alloc_contig_range(9) π§
okay bestie, welcome to the Kernel API Manual entry for alloc_contig_range(9) β it's giving βI reserve a whole contiguous PFN range for youβ energy, and honestly? iconic. π
πΈ NAME πΈ
alloc_contig_range β tries to allocate given range of pages β¨
π SYNOPSIS π
int alloc_contig_range (unsigned long start , unsigned long end ,
acr_flags_t alloc_flags , gfp_t gfp_mask );
π¦ ARGUMENTS π¦
startβ start PFN to allocateendβ one-past-the-last PFN to allocatealloc_flagsβ allocation informationgfp_maskβ GFP mask.
π DESCRIPTION π
So this routine is a wrapper around alloc_contig_frozen_range, and the important vibe check is: it can't be used to allocate compound pages. Also, the refcount of each allocated page will be set to one. No cap. π«Ά
All pages which PFN is in [start, end) are allocated for the caller, and should be freed with free_contig_range or by manually calling __free_page on each allocated page. Like, please clean up after yourself, bestie β the kernel is not your personal storage unit. πβ¨
π₯ RETURN π₯
zero on success or negative error code.
π SEE ALSO π
Kernel file ./mm/page_alloc.c:
__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_frozen_range(9)alloc_contig_frozen_pages(9)alloc_contig_pages(9)free_contig_frozen_range(9)free_contig_range(9)alloc_pages_nolock(9)
mwah π source/version line is ./mm, date is October 2026, and the manual name stays alloc_contig_range(9) β periodt. πβ
π¦ 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