alloc_pages_exact_nid(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ alloc_pages_exact_nid(9) ✨

okay bestie, welcome to the Kernel API Manual πŸ’– this one's a little kernel function that's lowkey obsessed with one specific node. let's get into it πŸŽ€


🌸 NAME 🌸

alloc_pages_exact_nid β€” allocate an exact number of physically-contiguous pages on a node. no cap, that's literally the whole vibe ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

void * alloc_pages_exact_nid (int nid , size_t size , gfp_t gfp_mask );

like... it takes three things and gives you a pointer, slay πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • nid β€” the preferred node ID where memory should be allocated πŸ‘‘ it's giving "i have a favourite and it's this node"
  • size β€” the number of bytes to allocate πŸ“ exact bytes, we don't do vibes-based sizing here
  • gfp_mask β€” GFP flags for the allocation, and bestie listen to me: must not contain __GFP_COMP 🚫 like, hard no, do not pass that

πŸ’œ DESCRIPTION πŸ’œ

so it's like alloc_pages_exact, but it tries to allocate on node nid first before falling back. that's it, that's the whole plot 🫢 highkey simple, highkey iconic.


🌈 RETURN 🌈

pointer to the allocated area, or NULL in case of error 😭 so yeah, always check your pointer, fr fr.


⭐ SEE ALSO ⭐

the whole kernel crew, assembled 🧚 and yeah, kernel file ./mm/page_alloc.c is where the magic lives:

like... a whole friend group 😭 love that for them πŸ’•


πŸ’€ reminder bestie: gfp_mask must not contain __GFP_COMP. i'm not gonna say it a third time... okay maybe i will. don't do it πŸ™ˆ

πŸ“ sign-off πŸ“

that's the page!! it lives in ./mm πŸ’– and this cutie was dated October 2026 ⭐ see you in the next manpage, mwah πŸ§šβ€β™€οΈπŸ’…βœ¨

πŸ“¦ where this page comes from