]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
sched/deadline: Prepare for switched_from() change
authorPeter Zijlstra <peterz@infradead.org>
Thu, 9 Oct 2025 14:09:25 +0000 (16:09 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Thu, 16 Oct 2025 09:13:51 +0000 (11:13 +0200)
commit5e42d4c123ba9b89ce19b3aa7e22b7684cbfa49c
treefa3df36befa48286c9f95633f70a7f3372aa551c
parent376f8963bbda5fee838eb1823b07562368104024
sched/deadline: Prepare for switched_from() change

Prepare for the sched_class::switch*() methods getting folded into the
change pattern. As a result of that, the location of switched_from
will change slightly. SCHED_DEADLINE is affected by this change in
location:

  OLD                              NEW
|
|  switching_from()
  dequeue_task(); |  dequeue_task()
  put_prev_task(); |  put_prev_task()
|  switched_from()
|
  ... change task ... |  ... change task ...
|
  switching_to(); |  switching_to()
  enqueue_task(); |  enqueue_task()
  set_next_task(); |  set_next_task()
  prev_class->switched_from() |
  switched_to() |  switched_to()
|

Notably, where switched_from() was called *after* the change to the
task, it will get called before it. Specifically, switched_from_dl()
uses dl_task(p) which uses p->prio; which is changed when switching
class (it might be the reason to switch class in case of PI).

When switched_from_dl() gets called, the task will have left the
deadline class and dl_task() must be false, while when doing
dequeue_dl_entity() the task must be a dl_task(), otherwise we'd have
called a different dequeue method.

Reported-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
kernel/sched/deadline.c