summaryrefslogtreecommitdiffstats
path: root/kernel/sched/sched.h
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2024-08-14 00:25:54 +0200
committerPeter Zijlstra <peterz@infradead.org>2024-09-03 15:26:31 +0200
commit436f3eed5c69c1048a5754df6e3dbb291e5cccbd (patch)
treebec07e3613426cc839f683bd77be69b3ef86e4af /kernel/sched/sched.h
parentsched: Rework pick_next_task() (diff)
downloadlinux-436f3eed5c69c1048a5754df6e3dbb291e5cccbd.tar.xz
linux-436f3eed5c69c1048a5754df6e3dbb291e5cccbd.zip
sched: Combine the last put_prev_task() and the first set_next_task()
Ensure the last put_prev_task() and the first set_next_task() always go together. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20240813224016.158454756@infradead.org
Diffstat (limited to 'kernel/sched/sched.h')
-rw-r--r--kernel/sched/sched.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 64a4ed758ba1..aae35818cca4 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -2370,8 +2370,16 @@ static inline void set_next_task(struct rq *rq, struct task_struct *next)
next->sched_class->set_next_task(rq, next, false);
}
-static inline void set_next_task_first(struct rq *rq, struct task_struct *next)
+static inline void put_prev_set_next_task(struct rq *rq,
+ struct task_struct *prev,
+ struct task_struct *next)
{
+ WARN_ON_ONCE(rq->curr != prev);
+
+ if (next == prev)
+ return;
+
+ prev->sched_class->put_prev_task(rq, prev);
next->sched_class->set_next_task(rq, next, true);
}