[PATCH 0/2] rust: cpumask: Bindings for core cpumasks and cpumask iterators

Mitchell Levy
2025-11-05T23:16:26Z

The kernel provides a number of very useful CPU masks from the C side,
including CPU masks for possible and online CPUs. In particular, these
are very useful when some operation must be done on each CPU (either
each possible CPU or each online CPU, etc). Therefore, it seems to make
sense to add both of these functionalities at once.

Signed-off-by: Mitchell Levy <levymitchell0@gmail.com>
---
These patches originated as part of my work on a Rust per-CPU API [1].
Boqun suggested to me that these may make sense to merge separately, and
it does seem like these might be useful beyond the per-CPU work.

[1]: https://lore.kernel.org/rust-for-linux/20251105-rust-percpu-v4-0-984b1470adcb@gmail.com/

---
Mitchell Levy (2):
rust: cpumask: Add a `Cpumask` iterator
rust: cpumask: Add getters for globally defined cpumasks

rust/helpers/cpumask.c | 5 +++
rust/kernel/cpumask.rs | 94 +++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 98 insertions(+), 1 deletion(-)
---
base-commit: f3f6b3664302e16ef1c6b91034a72df5564d6b8a
change-id: 20251105-cpumask-iter-ff0f1a5899b3

Best regards,
--
Mitchell Levy <levymitchell0@gmail.com>