cpuset_spread_node(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… cpuset_spread_node(9) β€” like, the Kernel API Manual, but make it make sense

okay bestie, welcome to the cpuset_spread_node(9) page ✨ this is the whole kernel-API-manual moment, and no cap, it's a short one, so we're gonna absolutely devour it.


🌸 NAME 🌸

cpuset_spread_node β€” literally just answers the question: on which node do we begin search for a page? πŸŽ€


✨ SYNOPSIS ✨

int cpuset_spread_node (int *rotor );

that's it. that's the whole call. iconic.


πŸ¦‹ ARGUMENTS πŸ¦‹

  • rotor β€” the round robin rotor πŸ’« yes it's called a rotor, yes that's a real word here, we love a spinning-adjacent naming moment.

πŸ”₯ DESCRIPTION πŸ”₯

okay so here's the vibe πŸ‘‘ when a task is marked PFA_SPREAD_PAGE and a page cache allocation uses cpuset_mem_spread_node to figure out where to start looking, this routine spreads that starting node around the task's mems_allowed nodes instead of just starting on the local node. spreading the love, spreading the search πŸ’–

and ngl, we don't have to worry about the returned node being offline, because "it can't happen" 😭 (yes, that's the actual reasoning, and honestly? mood). and even if it did happen, it would be okay. no drama.

here's why: the routines calling guarantee_online_mems are careful to only set nodes in task->mems_allowed that are online 🫢 so like, it should genuinely not be possible for the following code to return an offline node. but if it did, that would still be okay β€” because this routine is not returning the node where the allocation must be, only the node where the search should start. the zonelist the allocator uses will include all nodes ⭐ and if the slab allocator gets passed an offline node, it'll fall back to the local node. see kmem_cache_alloc_node for that whole situation πŸ’€

bestie reminder: "it can't happen" is doing a lot of emotional labour in this paragraph, so keep the fallback behaviour in mind. this is a hint, not a promise πŸ’…

πŸ’œ SEE ALSO πŸ’œ

kernel file ./kernel/cgroup/cpuset.c, plus the whole friend group:


aaaand that's the page πŸŽ€ this whole thing lives under ./kernel/cgroup β€” that's the source β€” and the version/date stamp on it is October 2026, so mark your calendar bestie πŸ—“οΈβœ¨ slay, go read the cpuset source, ily, bye πŸ’–

πŸ“¦ where this page comes from