sched/core: Clear prev->dl_server in CFS pick fast path
authorYoussef Esmat <youssefesmat@google.com>
Mon, 27 May 2024 12:06:49 +0000 (14:06 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 29 Jul 2024 10:22:35 +0000 (12:22 +0200)
In case the previous pick was a DL server pick, ->dl_server might be
set. Clear it in the fast path as well.

Fixes: 63ba8422f876 ("sched/deadline: Introduce deadline servers")
Signed-off-by: Youssef Esmat <youssefesmat@google.com>
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Juri Lelli <juri.lelli@redhat.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/7f7381ccba09efcb4a1c1ff808ed58385eccc222.1716811044.git.bristot@kernel.org
kernel/sched/core.c

index e61da3b88be31c549c9213e9fa7b2bf3562e3962..1074ae80448088d57a0eb0f14f52edd2c91bf323 100644 (file)
@@ -5839,6 +5839,13 @@ __pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
                        p = pick_next_task_idle(rq);
                }
 
+               /*
+                * This is a normal CFS pick, but the previous could be a DL pick.
+                * Clear it as previous is no longer picked.
+                */
+               if (prev->dl_server)
+                       prev->dl_server = NULL;
+
                /*
                 * This is the fast path; it cannot be a DL server pick;
                 * therefore even if @p == @prev, ->dl_server must be NULL.