Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sched/fair: Always trigger resched at the end of a protected period

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

authored by

Vincent Guittot and committed by
Peter Zijlstra
0b9ca2dc 3a0baa8e

+1 -9
+1 -9
kernel/sched/fair.c
··· 1182 1182 cgroup_account_cputime(p, delta_exec); 1183 1183 } 1184 1184 1185 - static inline bool resched_next_slice(struct cfs_rq *cfs_rq, struct sched_entity *curr) 1186 - { 1187 - if (protect_slice(curr)) 1188 - return false; 1189 - 1190 - return !entity_eligible(cfs_rq, curr); 1191 - } 1192 - 1193 1185 /* 1194 1186 * Used by other classes to account runtime. 1195 1187 */ ··· 1242 1250 if (cfs_rq->nr_queued == 1) 1243 1251 return; 1244 1252 1245 - if (resched || resched_next_slice(cfs_rq, curr)) { 1253 + if (resched || !protect_slice(curr)) { 1246 1254 resched_curr_lazy(rq); 1247 1255 clear_buddies(cfs_rq, curr); 1248 1256 }