summaryrefslogtreecommitdiffstats
path: root/kernel/sched/deadline.c
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2024-08-14 00:25:53 +0200
committerPeter Zijlstra <peterz@infradead.org>2024-09-03 15:26:31 +0200
commitfd03c5b8585562d60f8b597b4332d28f48abfe7d (patch)
tree11b3007a752affe6beaca37c057ca9a5c0983048 /kernel/sched/deadline.c
parentsched: Split up put_prev_task_balance() (diff)
downloadlinux-fd03c5b8585562d60f8b597b4332d28f48abfe7d.tar.xz
linux-fd03c5b8585562d60f8b597b4332d28f48abfe7d.zip
sched: Rework pick_next_task()
The current rule is that: pick_next_task() := pick_task() + set_next_task(.first = true) And many classes implement it directly as such. Change things around to make pick_next_task() optional while also changing the definition to: pick_next_task(prev) := pick_task() + put_prev_task() + set_next_task(.first = true) The reason is that sched_ext would like to have a 'final' call that knows the next task. By placing put_prev_task() right next to set_next_task() (as it already is for sched_core) this becomes trivial. As a bonus, this is a nice cleanup on its own. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20240813224016.051225657@infradead.org
Diffstat (limited to 'kernel/sched/deadline.c')
-rw-r--r--kernel/sched/deadline.c21
1 files changed, 1 insertions, 20 deletions
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 2ea929ce9e4f..a1547e1cd96e 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -2431,28 +2431,10 @@ again:
return p;
}
-#ifdef CONFIG_SMP
static struct task_struct *pick_task_dl(struct rq *rq)
{
return __pick_task_dl(rq);
}
-#endif
-
-static struct task_struct *pick_next_task_dl(struct rq *rq)
-{
- struct task_struct *p;
-
- p = __pick_task_dl(rq);
- if (!p)
- return p;
-
- if (p->dl_server)
- p->sched_class->set_next_task(rq, p, true);
- else
- set_next_task_dl(rq, p, true);
-
- return p;
-}
static void put_prev_task_dl(struct rq *rq, struct task_struct *p)
{
@@ -3146,13 +3128,12 @@ DEFINE_SCHED_CLASS(dl) = {
.wakeup_preempt = wakeup_preempt_dl,
- .pick_next_task = pick_next_task_dl,
+ .pick_task = pick_task_dl,
.put_prev_task = put_prev_task_dl,
.set_next_task = set_next_task_dl,
#ifdef CONFIG_SMP
.balance = balance_dl,
- .pick_task = pick_task_dl,
.select_task_rq = select_task_rq_dl,
.migrate_task_rq = migrate_task_rq_dl,
.set_cpus_allowed = set_cpus_allowed_dl,