alloc_contig_range(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🧚 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 allocate
  • end β€” one-past-the-last PFN to allocate
  • alloc_flags β€” allocation information
  • gfp_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:


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