get_pfn_range_for_nid(9)
π get_pfn_range_for_nid(9) β Kernel API Manual π
okay bestie, welcome to the Kernel API Manual, and today's main character is get_pfn_range_for_nid β the little function that tells you where a node's memory actually lives. no cap, it's giving "where's the party and where does it end" energy β¨
πΈ NAME πΈ
get_pfn_range_for_nid β returns the start and end page frames for a node π
β¨ SYNOPSIS β¨
void get_pfn_range_for_nid (unsigned int nid , unsigned long *start_pfn
, unsigned long *end_pfn );
like, that's the whole signature, and yes, she takes pointers β we love a function that writes back to you π«Ά
π¦ ARGUMENTS π¦
nidβ the node id you want the range for, periodt. and here's the plot twist: if it'sMAX_NUMNODES, you get the min and max PFN back instead. iykyk πstart_pfnβ passed by reference, bestie. on return it'll be holding the nodestart_pfn. she doesn't come empty, she comes filled in πend_pfnβ same deal, also passed by reference. on return it'll have the nodeend_pfn. twin behavior, honestly iconic π
π₯ DESCRIPTION π₯
so what does she actually do? she returns the start and end page frame of a node, based on the info that memblock_set_node handed over. that's the source of truth, no guessing π
β οΈ but listen β if you call her for a node with no available memory, the start and end PFNs will both be 0. that's not a bug, that's just the vibe check coming back empty. don't @ me π
π SEE ALSO π
- Kernel file
./mm/mm_init.cπ absent_pages_in_range(9)free_area_init(9)node_map_pfn_alignment(9)
go read those if you're nosy, which β same π§
and that's the whole page, bestie π straight from ./mm, October 2026 edition β get_pfn_range_for_nid(9), slaying in a kernel near you ππ
π¦ 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