dup_or_alloc_cpuset(9)
π
dup_or_alloc_cpuset(9) β the dup_or_alloc_cpuset page, bestie π
okay so this is a page from the Kernel API Manual and honestly it's giving "short but mighty" β¨ β the whole thing is one function that does one little job and does it flawlessly. let's get into it π«Ά
β¨ NAME β¨
dup_or_alloc_cpuset β duplicate or allocate a new cpuset π
like, the name literally tells you the whole plot. either you're copying a cpuset or you're making a fresh one. that's it. that's the function. periodt π
πΈ SYNOPSIS πΈ
struct cpuset * dup_or_alloc_cpuset (struct cpuset *cs );
so it takes one pointer to a struct cpuset, hands you back a pointer to a struct cpuset, and that's the whole signature. no cap, it's that simple. lowkey iconic for how unbothered it is π
π¦ ARGUMENTS π¦
csβ the source cpuset you wanna duplicate, bestie. and if you passNULL? then it skips the whole copying thing entirely and just does a fresh allocation for you instead π
π DESCRIPTION π
so what actually happens inside? great question, glad you asked π
This creates a new cpuset by either:
- Duplicating an existing cpuset β this is the path you take when
csis non-NULLβ¨ you already got a cpuset and you want a copy of it, slay. - Allocating a fresh cpuset with zero-initialized masks β this is the
NULLroute π§ you hand it nothing and it hands you back a brand new cpuset whose masks are all zeroed out. clean slate energy, main character energy, we love to see it π
two branches, one function. choose your fighter π
β RETURN β
- On success? you get a pointer to the newly allocated cpuset π ate and left no crumbs
- On failure? you get
NULLπ and ngl you should probably check for that before you go dereferencing it, just saying π
π SEE ALSO π
okay this is the part where the page just goes off β the related-reference list is genuinely enormous and honestly? we're obsessed. all of these live in the kernel file ./kernel/cgroup/cpuset.c π
cpuset_lock(9)cpuset_full_lock(9)partition_is_populated(9)alloc_cpumasks(9)alloc_tmpmasks(9)free_tmpmasks(9)free_cpuset(9)cpus_excl_conflict(9)cpuset_update_tasks_cpumask(9)compute_effective_cpumask(9)compute_effective_nodemask(9)rm_siblings_excl_cpus(9)update_parent_effective_cpumask(9)compute_partition_effective_cpumask(9)update_sibling_cpumasks(9)validate_partition(9)partition_cpus_change(9)update_cpumask(9)update_exclusive_cpumask(9)cpuset_update_tasks_nodemask(9)update_prstate(9)cpuset_css_alloc(9)cpuset_init(9)cpuset_hotplug_update_tasks(9)cpuset_handle_hotplug(9)cpuset_init_smp(9)cpuset_cpus_allowed_locked(9)cpuset_cpus_allowed(9)cpuset_cpus_allowed_fallback(9)cpuset_mems_allowed(9)cpuset_nodemask_valid_mems_allowed(9)cpuset_nodes_allowed(9)cpuset_spread_node(9)cpuset_mem_spread_node(9)cpuset_mems_allowed_intersects(9)cpuset_print_current_mems_allowed(9)
iykyk β cpuset girlies stay booked and busy π β¨
and that's the page!! π brought to you from ./kernel/cgroup, dated October 2026 πΈ bestie go forth and duplicate responsibly π«Άπ
π¦ 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