aboutsummaryrefslogtreecommitdiffstats
path: root/rust/helpers/helpers.c
diff options
context:
space:
mode:
authorViresh Kumar <[email protected]>2025-06-09 11:14:16 +0000
committerViresh Kumar <[email protected]>2025-06-12 05:01:28 +0000
commitc7f005f70d22cd5613cac30bf6d34867189e36a9 (patch)
treeca697ecc8168ed4d9ca9315ac08ed530ac204c61 /rust/helpers/helpers.c
parentrust: Use CpuId in place of raw CPU numbers (diff)
downloadkernel-c7f005f70d22cd5613cac30bf6d34867189e36a9.tar.gz
kernel-c7f005f70d22cd5613cac30bf6d34867189e36a9.zip
rust: cpu: Add CpuId::current() to retrieve current CPU ID
Introduce `CpuId::current()`, a constructor that wraps the C function `raw_smp_processor_id()` to retrieve the current CPU identifier without guaranteeing stability. This function should be used only when the caller can ensure that the CPU ID won't change unexpectedly due to preemption or migration. Suggested-by: Boqun Feng <[email protected]> Signed-off-by: Viresh Kumar <[email protected]> Reviewed-by: Boqun Feng <[email protected]>
Diffstat (limited to 'rust/helpers/helpers.c')
-rw-r--r--rust/helpers/helpers.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c
index 0f1b5d115985..16fa9bca5949 100644
--- a/rust/helpers/helpers.c
+++ b/rust/helpers/helpers.c
@@ -13,6 +13,7 @@
#include "build_assert.c"
#include "build_bug.c"
#include "clk.c"
+#include "cpu.c"
#include "cpufreq.c"
#include "cpumask.c"
#include "cred.c"