numa_nearest_node(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’« 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 🌸


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