sched_numa_hop_mask(9)
π sched_numa_hop_mask(9) β a Kernel API Manual moment
okay bestie, welcome to the sched_numa_hop_mask(9) page, straight out of the Kernel API Manual β¨ this one's a little function with big "don't hold onto this pointer" energy, so stay with me π«Ά
πΈ NAME
sched_numa_hop_mask β get the cpumask of CPUs at most @hops hops away from @node π
β¨ SYNOPSIS
const struct cpumask * sched_numa_hop_mask (unsigned int node , unsigned int hops );
like, that's the whole signature. short. iconic. no cap π
π ARGUMENTS
nodeβ the node you're counting hops from. that's your starting point, your main character node πhopsβ include CPUs up to that many hops away. and0means local node, i.e. the node itself, zero travelling required π
π¦ RETURN
On success you get a pointer to a cpumask of CPUs at most hops away from node. on failure? you get an error value instead π so like, check it, bestie.
π₯ DESCRIPTION
Requires rcu_lock to be held. fr fr, this is not optional.
The returned cpumask is only valid within that read-side section β so if you need it beyond that, copy it. don't be out here holding a pointer to vibes that already expired π
Also note that not all hops are equal in distance; see sched_init_numa for how distances and masks are handled π (yes, a hop is not just a hop, it's giving "it's complicated" π).
And also note that this is a reflection of sched_domains_numa_masks, which may change during the lifetime of the system β offline nodes are taken out of the masks. so the mask can literally change under you. lowkey important. highkey important actually β
π SEE ALSO
- Kernel file
./kernel/sched/topology.c sched_numa_find_nth_cpu(9)
that's the whole page, bestie, you ate that πβ¨ sign-off time: this lil cutie lives in ./kernel/sched, dated October 2026, and it's still called sched_numa_hop_mask(9) ππ
π¦ 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