numa_nearest_node(9)
π« numa_nearest_node(9) π«
okay bestie, welcome to the Kernel API Manual β this one's numa_nearest_node(9) and it's lowkey one of the cutest little helpers in the mm department, iykyk π
β¨ NAME β¨
numa_nearest_node β find nearest node by state π¦
β¨ SYNOPSIS β¨
int numa_nearest_node (int node , unsigned int state );
β¨ ARGUMENTS β¨
nodeβ the node id you're starting the search from, like your starting point on the map πstateβ the state you're filtering the search by, aka the vibe check every node has to pass β
β¨ DESCRIPTION β¨
So here's the tea β β this bad boy does a lookup of the closest node by distance if nid is not in state. That's it, that's the whole plot. It's giving "I want the nearest node, but only one that matches my state, and if my starting node doesn't match, go find the next best thing." No cap π
β¨ RETURN β¨
It returns this node if it's in state β slay, immediate win, no travel required π β otherwise it hands you back the closest node by distance. Either way you get a node, so honestly? We love a reliable king π«Ά
β¨ SEE ALSO β¨
okay these are the besties in the same friend group, all hanging out in the kernel file ./mm/mempolicy.c πΈ
nearest_node_nodemask(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)
ngl if you made it this far you're officially a node-finding icon πβ¨ go read the source, it's right there in ./mm π§
kisses, this page lives in ./mm, October 2026 edition, and it's numa_nearest_node(9) forever and always, periodt ππβ
π¦ 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