[PATCH] rust: sync: completion: document Send and Sync safety
From: Younes Akhouayri via B4 Relay
Date: Tue Aug 11 2026 - 14:43:47 EST
From: Younes Akhouayri <git@xxxxxxxxx>
The existing safety comments only restate the guarantees provided by
Send and Sync. Document that completions have no task affinity, that
moving an owning pointer preserves pinning, and that the C API serializes
access to the completion state with wait.lock.
Signed-off-by: Younes Akhouayri <git@xxxxxxxxx>
---
rust/kernel/sync/completion.rs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/rust/kernel/sync/completion.rs b/rust/kernel/sync/completion.rs
index 35ff049ff078..b5842f04887b 100644
--- a/rust/kernel/sync/completion.rs
+++ b/rust/kernel/sync/completion.rs
@@ -69,10 +69,12 @@ pub struct Completion {
inner: Opaque<bindings::completion>,
}
-// SAFETY: `Completion` is safe to be send to any task.
+// SAFETY: `Completion` has no task affinity, and moving an owning pointer to another task preserves
+// the pinning of the underlying `struct completion`.
unsafe impl Send for Completion {}
-// SAFETY: `Completion` is safe to be accessed concurrently.
+// SAFETY: The C completion API protects accesses to `done` and the wait queue with `wait.lock`, so
+// the operations exposed through shared references may be called concurrently.
unsafe impl Sync for Completion {}
impl Completion {
---
base-commit: 8fe5e5f62bdb9660999449a4b5eaebcc37d7f842
change-id: 20260811-docs-completion-send-sync-safety-296f16d6135c
Best regards,
--
Younes Akhouayri <git@xxxxxxxxx>