nearest_node_nodemask(9)
π nearest_node_nodemask β Kernel API Manual, bestie edition π
okay so this is nearest_node_nodemask(9) from the Kernel API Manual and honestly? she's a little icon. let's get into it π«Ά
β¨ NAME β¨
nearest_node_nodemask β finds the node in @mask that's at the nearest distance from @node. that's it. that's the whole job. and she does it slayfully π
πΈ SYNOPSIS πΈ
int nearest_node_nodemask (int node , nodemask_t *mask );
look at her. tiny. perfect. no cap. π
π¦ ARGUMENTS π¦
nodeβ a valid node ID, the place you're starting your little search from. this is your main character. your origin point. β¨maskβ a pointer to anodemaskrepresenting all the allowed nodes. like the guest list at the function, except the function is a NUMA topology π
π DESCRIPTION π
so what she does is literally this: she iterates over all the nodes in mask, calculates the distance from the starting node for each one, and then returns the node ID that is the closest to node. lowkey a queen for that π
and if no node is found? she returns MAX_NUMNODES. respect the fallback. periodt. π
β οΈ okay bestie listen to me on this one β οΈ βnodemust be a valid node ID usable withnode_distance. if you hand her an invalid node ID (likeNUMA_NO_NODEfor example), you may end up with crashes or unexpected behavior. and not the cute kind of unexpected. theπkind. please do a vibe check on your arguments before calling. fr fr.
π₯ SEE ALSO π₯
- Kernel file
./mm/mempolicy.c numa_nearest_node(9)folio_can_map_prot_numa(9)alloc_pages_mpol(9)vma_alloc_folio(9)alloc_pages(9)mpol_misplaced(9)mpol_shared_policy_init(9)mpol_parse_str(9)mpol_to_str(9)
go read them. iykyk. ππ«
πΈ that's the whole page, diva πΈ she lives in ./mm, dated October 2026, and she's filed under the name nearest_node_nodemask(9). go off, nearest-node queen. πππ
π¦ 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