alloc_contig_frozen_range(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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:


πŸ’… 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