alloc_cpumasks(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ alloc_cpumasks ✨

okay so real talk, bestie β€” this is a page from the Kernel API Manual, section 9 (the kernel API girlies, iykyk), and it's all about alloc_cpumasks. it's lowkey iconic and honestly kind of a lifesaver. let's get into it πŸ’…


🌸 NAME 🌸

alloc_cpumasks β€” allocate an array of cpumask variables

like, the whole entire point: you want a bunch of cpumasks? you get a bunch of cpumasks. periodt. ✨


πŸŽ€ SYNOPSIS πŸŽ€

int alloc_cpumasks (cpumask_var_t *pmasks[] , u32 size );

she takes an array-of-pointers situation and a size, and she gives you back an int. that's the whole vibe check. πŸ¦‹


πŸ’– ARGUMENTS πŸ’–

  • pmasks β€” pointer to an array of cpumask_var_t pointers. yes, it's pointers-to-pointers-to-... we know. it's giving inception but make it kernel. this is where your shiny new cpumasks are gonna land. 🫢
  • size β€” the number of cpumasks to allocate. u32, so she's got range πŸ‘‘

🌈 RETURN 🌈

  • 0 if successful πŸŽ‰
  • -ENOMEM otherwise 😭

that's it. binary queen. no in-between, no "maybe", no "it's complicated".


⭐ DESCRIPTION ⭐

so here's the tea β˜• β€” alloc_cpumasks allocates size cpumasks and initializes them to empty. clean slate, blank canvas, fresh start energy 🧚✨

returns 0 on success, and -ENOMEM on allocation failure.

and listen β€” on failure, any previously allocated cpumasks are freed. she cleans up after herself, no leaked mess left behind. no cap, that's the good behavior we stan. πŸ’―

πŸ”₯ SEE ALSO πŸ”₯

these all live in the kernel file ./kernel/cgroup/cpuset.c, and honestly? it's a whole friend group. go say hi πŸ‘‹


and that's the page, bestie 🫢 this whole thing is brought to you by ./kernel/cgroup, dated October 2026 β€” so she's fresh, she's current, she's literally the moment. mwah πŸ’‹ go allocate some cpumasks, slay, and remember: free what you alloc. love u, bye πŸ’œπŸŒ·

πŸ“¦ where this page comes from