[tip: sched/core] sched/core: Mark wakeups completed through ttwu_runnable()
From: tip-bot2 for Andrea Righi
Date: Mon Sep 28 2026 - 03:08:28 EST
The following commit has been merged into the sched/core branch of tip:
Commit-ID: a49653d0abebee32bf3ecf650fae9f9dd8298135
Gitweb: https://git.kernel.org/tip/a49653d0abebee32bf3ecf650fae9f9dd8298135
Author: Andrea Righi <arighi@xxxxxxxxxx>
AuthorDate: Tue, 22 Sep 2026 18:51:42 +02:00
Committer: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
CommitterDate: Mon, 28 Sep 2026 08:44:39 +02:00
sched/core: Mark wakeups completed through ttwu_runnable()
ttwu_runnable() completes a wakeup for a task which remains queued
without calling activate_task() or its scheduling-class enqueue
callback. Scheduling classes currently cannot distinguish this path
from wakeups which performed a full activation.
Add WF_TTWU_RQ to identify wakeups completed through ttwu_runnable().
A later sched_ext change uses it to reconsider retained proxy donors
which wake without another ops.enqueue() call.
No functional change.
Signed-off-by: Andrea Righi <arighi@xxxxxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Link: https://patch.msgid.link/20260922165445.943315-4-arighi@xxxxxxxxxx
---
kernel/sched/core.c | 2 +-
kernel/sched/sched.h | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 07cc171..6b42f91 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3919,7 +3919,7 @@ static int ttwu_runnable(struct task_struct *p, int wake_flags)
* When on_rq && !on_cpu the task is preempted, see if
* it should preempt the task that is current now.
*/
- wakeup_preempt(rq, p, wake_flags);
+ wakeup_preempt(rq, p, wake_flags | WF_TTWU_RQ);
}
ttwu_do_wakeup(p);
return 1;
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index b98084e..a0f391f 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -2545,6 +2545,7 @@ static inline int task_on_rq_migrating(struct task_struct *p)
#define WF_MIGRATED 0x20 /* Internal use, task got migrated */
#define WF_CURRENT_CPU 0x40 /* Prefer to move the wakee to the current CPU. */
#define WF_RQ_SELECTED 0x80 /* ->select_task_rq() was called */
+#define WF_TTWU_RQ 0x100 /* Wakeup completed through ttwu_runnable() */
static_assert(WF_EXEC == SD_BALANCE_EXEC);
static_assert(WF_FORK == SD_BALANCE_FORK);