2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00

- Fix a stall on the CPU offline path due to mis-counting a deadline server

task twice as part of the runqueue's running tasks count
 
 - Fix a realtime tasks starvation case where failure to enqueue a timer whose
   expiration time is already in the past would cause repeated attempts to
   re-enqueue a deadline server task which leads to starving the former,
   realtime one
 
 - Prevent a delayed deadline server task stop from breaking the per-runqueue
   bandwidth tracking
 
 - Have a function checking whether the deadline server task has stopped,
   return the correct value
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEzv7L6UO9uDPlPSfHEsHwGGHeVUoFAmi0GaYACgkQEsHwGGHe
 VUphpRAAuI0Ra8fDwy+VRLoHYVseGHw/SZuffgd6WVu1J5Vag9TSJzl4+mDBsLVU
 42+b5+KSWbnX5zMDKgOhx7MU6AOgR3UCDlQEAMtKYI1CFD7ADe+Jwr45jG32Z50s
 bAl4LHhFeTHJx+jLP5Ez5tTwCTc2/Q7UbhadpGgTLQOhvrFPDwsDjrlMgClXgYU4
 DNEF6s6m9X31UJ/jnZNJQ7VeXa6SdqNo2fBZU+SoY1J8GYzGgcUDlCNLD0SnQwMe
 CgGCnYyzOjl9oNdKV2Z14ruCZwkfhv3hlVt0qHwlRKiP8OOdNKWN0FMIAtvyD0QM
 IQXITVIsc+T/diihZEGNR7wHRd0vhZ/cZPLoPjUQ7mNYB4IuCtWJrbLZf4W17CbG
 0clZ/OxG0EmOTKSuxBOxjg5tUtWI9ZqBHPFvBXFFl+6AhHTb1QK0hriAqbaqe0t6
 rOmohWKqg55yQxuhr0VXUgHy4Oq4u4WBZCF1OH02wtk6w87EHawuWPrULp5jR2iM
 BUXazn8CiTc13IBm+NhO9X45GfH1wIHC0Uhul+gWhylzG6gFRWN0CNixqPjd/7M7
 GS5gpH7xVs6Qe5DmAG9WHIXGLHPhda8OkyvzYK5MMtwJ7zpdPvqH3LCbO/uXspMy
 qYJWG+z3ni09SBX6EnZGLjenzOApsRuYL85NvFK8lOv6LG/SSO0=
 =NXg1
 -----END PGP SIGNATURE-----

Merge tag 'sched_urgent_for_v6.17_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull scheduler fixes from Borislav Petkov:

 - Fix a stall on the CPU offline path due to mis-counting a deadline
   server task twice as part of the runqueue's running tasks count

 - Fix a realtime tasks starvation case where failure to enqueue a timer
   whose expiration time is already in the past would cause repeated
   attempts to re-enqueue a deadline server task which leads to starving
   the former, realtime one

 - Prevent a delayed deadline server task stop from breaking the
   per-runqueue bandwidth tracking

 - Have a function checking whether the deadline server task has
   stopped, return the correct value

* tag 'sched_urgent_for_v6.17_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  sched/deadline: Don't count nr_running for dl_server proxy tasks
  sched/deadline: Fix RT task potential starvation when expiry time passed
  sched/deadline: Always stop dl-server before changing parameters
  sched/deadline: Fix dl_server_stopped()
This commit is contained in:
Linus Torvalds 2025-08-31 09:13:00 -07:00
commit fe3ad7a58b
2 changed files with 14 additions and 10 deletions

View File

@ -1496,10 +1496,12 @@ throttle:
} }
if (unlikely(is_dl_boosted(dl_se) || !start_dl_timer(dl_se))) { if (unlikely(is_dl_boosted(dl_se) || !start_dl_timer(dl_se))) {
if (dl_server(dl_se)) if (dl_server(dl_se)) {
enqueue_dl_entity(dl_se, ENQUEUE_REPLENISH); replenish_dl_new_period(dl_se, rq);
else start_dl_timer(dl_se);
} else {
enqueue_task_dl(rq, dl_task_of(dl_se), ENQUEUE_REPLENISH); enqueue_task_dl(rq, dl_task_of(dl_se), ENQUEUE_REPLENISH);
}
} }
if (!is_leftmost(dl_se, &rq->dl)) if (!is_leftmost(dl_se, &rq->dl))
@ -1611,7 +1613,7 @@ void dl_server_stop(struct sched_dl_entity *dl_se)
static bool dl_server_stopped(struct sched_dl_entity *dl_se) static bool dl_server_stopped(struct sched_dl_entity *dl_se)
{ {
if (!dl_se->dl_server_active) if (!dl_se->dl_server_active)
return false; return true;
if (dl_se->dl_server_idle) { if (dl_se->dl_server_idle) {
dl_server_stop(dl_se); dl_server_stop(dl_se);
@ -1849,7 +1851,9 @@ void inc_dl_tasks(struct sched_dl_entity *dl_se, struct dl_rq *dl_rq)
u64 deadline = dl_se->deadline; u64 deadline = dl_se->deadline;
dl_rq->dl_nr_running++; dl_rq->dl_nr_running++;
add_nr_running(rq_of_dl_rq(dl_rq), 1);
if (!dl_server(dl_se))
add_nr_running(rq_of_dl_rq(dl_rq), 1);
inc_dl_deadline(dl_rq, deadline); inc_dl_deadline(dl_rq, deadline);
} }
@ -1859,7 +1863,9 @@ void dec_dl_tasks(struct sched_dl_entity *dl_se, struct dl_rq *dl_rq)
{ {
WARN_ON(!dl_rq->dl_nr_running); WARN_ON(!dl_rq->dl_nr_running);
dl_rq->dl_nr_running--; dl_rq->dl_nr_running--;
sub_nr_running(rq_of_dl_rq(dl_rq), 1);
if (!dl_server(dl_se))
sub_nr_running(rq_of_dl_rq(dl_rq), 1);
dec_dl_deadline(dl_rq, dl_se->deadline); dec_dl_deadline(dl_rq, dl_se->deadline);
} }

View File

@ -376,10 +376,8 @@ static ssize_t sched_fair_server_write(struct file *filp, const char __user *ubu
return -EINVAL; return -EINVAL;
} }
if (rq->cfs.h_nr_queued) { update_rq_clock(rq);
update_rq_clock(rq); dl_server_stop(&rq->fair_server);
dl_server_stop(&rq->fair_server);
}
retval = dl_server_apply_params(&rq->fair_server, runtime, period, 0); retval = dl_server_apply_params(&rq->fair_server, runtime, period, 0);
if (retval) if (retval)