[PATCH v3 0/3] rust: add a few helpers
From: Andreas Hindborg
Date: Tue Sep 29 2026 - 13:59:12 EST
This series adds two helpers for obtaining information about the number
of numa domains and cpu count of the system. It also moves the `NumaNode`
struct from `alloc` to `numa`.
Signed-off-by: Andreas Hindborg <a.hindborg@xxxxxxxxxx>
---
Changes in v3:
- Drop Alice tag on patch 2 due to restructuring.
- Use a relaxed load to read `nr_online_nodes` (Gary).
- Move `NumaNode` from the `alloc` module to the `numa` module in a
new patch (Alice).
- Rebase on v7.3-rc5.
- Link to v2: https://msgid.link/20260605-cpu-helpers-v2-0-0ad227f0d91b@xxxxxxxxxx
Changes in v2:
- Move helpers out of the crate root into the `cpu` and `numa`
modules (Miguel).
- Mark Rust wrappers `#[inline]` (Alice).
- Mark the `num_possible_cpus` C helper `__rust_helper` (Dirk).
- Mention the Rust null block driver as the consumer in commit
messages (Miguel).
- Link to v1: https://msgid.link/20260215-cpu-helpers-v1-0-fab13d817a5e@xxxxxxxxxx
---
Andreas Hindborg (3):
rust: add a wrapper for the `num_possible_cpus` C function
rust: add a wrapper for the `nr_online_nodes` C function
rust: alloc: move `NumaNode` to the `numa` module
rust/helpers/helpers.c | 1 +
rust/helpers/num_cpus.c | 8 ++++++
rust/kernel/alloc.rs | 30 +++-----------------
rust/kernel/alloc/allocator.rs | 6 ++--
rust/kernel/alloc/kbox.rs | 4 +--
rust/kernel/alloc/kvec.rs | 4 +--
rust/kernel/cpu.rs | 7 +++++
rust/kernel/lib.rs | 1 +
rust/kernel/numa.rs | 62 ++++++++++++++++++++++++++++++++++++++++++
9 files changed, 90 insertions(+), 33 deletions(-)
---
base-commit: 72d3fcf802c45d00b300f25b848a93c3a2bd7c7e
change-id: 20260215-cpu-helpers-08efb2572487
Best regards,
--
Andreas Hindborg <a.hindborg@xxxxxxxxxx>