[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251016-complete_on_current_cpu_doc-v3-1-8ae5d346ea45@gmail.com>
Date: Thu, 16 Oct 2025 15:55:07 +0800
From: Javier Carrasco <javier.carrasco.cruz@...il.com>
To: Jonathan Corbet <corbet@....net>,
Peter Zijlstra <peterz@...radead.org>,
Andrei Vagin <avagin@...il.com>
Cc: Javier Carrasco <javier.carrasco.cruz@...il.com>,
linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v3] docs: scheduler: completion: Document complete_on_current_cpu()
Commit 6f63904c8f3e ("sched: add a few helpers to wake up tasks on the
current cpu") introduced this new function to the completion API that
has not been documented yet.
Document complete_on_current_cpu() explaining what it does and when its
usage is justified.
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@...il.com>
---
Changes in v3:
- Rebase onto v6.18-rc1
- Document the scenario where the gain is relevant (Andrei Vagin)
- Link to v2: https://lore.kernel.org/r/20250824-complete_on_current_cpu_doc-v2-1-fd13debcb020@gmail.com/
Changes in v2:
- Rebase onto v6.17-rc1
- Fix patch formatting (drop --- before the Signed-off-by tag).
- Link to v1: https://lore.kernel.org/r/20250703-complete_on_current_cpu_doc-v1-1-262dc859b38a@gmail.com
---
Documentation/scheduler/completion.rst | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Documentation/scheduler/completion.rst b/Documentation/scheduler/completion.rst
index adf0c0a56d02..139700c56964 100644
--- a/Documentation/scheduler/completion.rst
+++ b/Documentation/scheduler/completion.rst
@@ -272,6 +272,11 @@ Signaling completion from IRQ context is fine as it will appropriately
lock with spin_lock_irqsave()/spin_unlock_irqrestore() and it will never
sleep.
+Use complete_on_current_cpu() to wake up the task on the current CPU.
+It makes use of the WF_CURRENT_CPU flag to move the task to be woken up
+to the current CPU, achieving faster context switches. For this optimization
+to be effective, the current task must be about to go to sleep right after
+waking the target task.
try_wait_for_completion()/completion_done():
--------------------------------------------
---
base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
change-id: 20250702-complete_on_current_cpu_doc-94dfc72a39f8
Best regards,
--
Javier Carrasco <javier.carrasco.cruz@...il.com>
Powered by blists - more mailing lists