rust: sync: add `CondVar::notify_sync`
authorAlice Ryhl <aliceryhl@google.com>
Mon, 8 Jan 2024 14:49:57 +0000 (14:49 +0000)
committerMiguel Ojeda <ojeda@kernel.org>
Sun, 28 Jan 2024 18:50:35 +0000 (19:50 +0100)
commit3e6454177f3a76265cba4901d5caa4eb0c7b6447
tree8ff1028729190eabf77b70a57d10459acfdf8c3f
parent6b1b2326b2bc3d6a90ec04815130d59ae57f3bc1
rust: sync: add `CondVar::notify_sync`

Wake up another thread synchronously.

This method behaves like `notify_one`, except that it hints to the
scheduler that the current thread is about to go to sleep, so it should
schedule the target thread on the same CPU.

This is used by Rust Binder as a performance optimization. When sending
a transaction to a different process, we usually know which thread will
handle it, so we can schedule that thread for execution next on this
CPU for better cache locality.

Reviewed-by: Benno Lossin <benno.lossin@proton.me>
Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
Reviewed-by: Tiago Lam <tiagolam@gmail.com>
Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Link: https://lore.kernel.org/r/20240108-rb-new-condvar-methods-v4-1-88e0c871cc05@google.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/kernel/sync/condvar.rs