cpumask_first(9)
π cpumask_first(9) β the kernel API manual, bestie edition β¨
Okay so real talk, this page lives in the kernel API manual (section 9, iykyk) and it's about cpumask_first β the tiny little legend that finds you the very first cpu in a cpumask. Yeah. That's it. That's the whole gig. And honestly? She ate. π
πΈ NAME πΈ
cpumask_first β get the first cpu in a cpumask. literally just the first one, no drama β¨
π¦ SYNOPSIS π¦
unsigned int cpumask_first (const struct cpumask *srcp );
copy it exactly like that, spaces and all, bestie β the trailing space before that last paren is part of the vibe π
π ARGUMENTS π
srcpβ the cpumask pointer. it's the mask you're handing over so she can go find the first cpu in it. that's the whole assignment. π«Ά
β¨ RETURN β¨
She gives you back the first cpu. And if there are no cpus set at all? You get something >= nr_cpu_ids β which is your little signal that the mask was empty and there was nothing to find. no cap, that's the check π
β οΈ fr fr remember: >= nr_cpu_ids means empty mask, not a real cpu. always vibe-check the return value before you go using it as a cpu id. π
π SEE ALSO π
The whole cpumask friend group showed up, and we're listing every single one of them because we don't do half-messages in this group chat π
Specifically: Kernel file ./include/linux/cpumask.h, plus β
cpumask_pr_args(9),cpumask_first_zero(9),cpumask_first_and(9),cpumask_first_andnot(9),cpumask_first_and_and(9),cpumask_last(9),cpumask_next(9),cpumask_next_zero(9),cpumask_next_and(9),cpumask_next_andnot(9),cpumask_next_and_wrap(9),cpumask_next_wrap(9),cpumask_random(9)for_each_cpu(9),for_each_cpu_wrap(9),for_each_cpu_and(9),for_each_cpu_andnot(9),for_each_cpu_or(9),for_each_cpu_from(9)cpumask_any_but(9),cpumask_any_and_but(9),cpumask_any_andnot_but(9),cpumask_nth(9),cpumask_nth_and(9),cpumask_nth_and_andnot(9)cpumask_set_cpu(9),cpumask_clear_cpus(9),cpumask_clear_cpu(9),cpumask_test_cpu(9),cpumask_test_and_set_cpu(9),cpumask_test_and_clear_cpu(9),cpumask_setall(9),cpumask_clear(9)cpumask_and(9),cpumask_or(9),cpumask_weighted_or(9),cpumask_xor(9),cpumask_andnot(9),cpumask_equal(9),cpumask_or_equal(9),cpumask_intersects(9),cpumask_subset(9),cpumask_empty(9),cpumask_full(9),cpumask_weight(9),cpumask_weight_and(9),cpumask_weight_andnot(9),cpumask_shift_right(9),cpumask_shift_left(9),cpumask_copy(9)cpumask_any(9),cpumask_any_and(9),cpumask_of(9),cpumask_parse_user(9),cpumask_parselist_user(9),cpumask_parse(9),cpulist_parse(9),cpumask_size(9),alloc_cpumask_var(9),to_cpumask(9),num_online_cpus(9),cpumap_print_bitmask_to_buf(9),cpumap_print_list_to_buf(9)
likeβ¦ the whole roster. iconic behavior, honestly π
okay that's the whole page, you're officially a cpumask_first understander, go be the main character of your own scheduler π§
sign-off szn: this little masterpiece comes from ./include/linux (yes, the directory, she's humble) and it's dated October 2026. πβ¨π¦
π¦ 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