]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
sched/fair: Always trigger resched at the end of a protected period
authorVincent Guittot <vincent.guittot@linaro.org>
Tue, 8 Jul 2025 16:56:30 +0000 (18:56 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Wed, 9 Jul 2025 11:40:23 +0000 (13:40 +0200)
Always trigger a resched after a protected period even if the entity is
still eligible. It can happen that an entity remains eligible at the end
of the protected period but must let an entity with a shorter slice to run
in order to keep its lag shorter than slice. This is particulalry true
with run to parity which tries to maximize the lag.

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20250708165630.1948751-7-vincent.guittot@linaro.org
kernel/sched/fair.c

index 1660960d64afef4aca0ea567edc87f933f9598a6..20a845697c1dc7c4b8f2ece975cdd4c77ab389b6 100644 (file)
@@ -1182,14 +1182,6 @@ static inline void update_curr_task(struct task_struct *p, s64 delta_exec)
        cgroup_account_cputime(p, delta_exec);
 }
 
-static inline bool resched_next_slice(struct cfs_rq *cfs_rq, struct sched_entity *curr)
-{
-       if (protect_slice(curr))
-               return false;
-
-       return !entity_eligible(cfs_rq, curr);
-}
-
 /*
  * Used by other classes to account runtime.
  */
@@ -1250,7 +1242,7 @@ static void update_curr(struct cfs_rq *cfs_rq)
        if (cfs_rq->nr_queued == 1)
                return;
 
-       if (resched || resched_next_slice(cfs_rq, curr)) {
+       if (resched || !protect_slice(curr)) {
                resched_curr_lazy(rq);
                clear_buddies(cfs_rq, curr);
        }