Skip to content

Commit fe3ad7a

Browse files
committed
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()
2 parents c9e4e96 + 52d1552 commit fe3ad7a

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

kernel/sched/deadline.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,10 +1496,12 @@ static void update_curr_dl_se(struct rq *rq, struct sched_dl_entity *dl_se, s64
14961496
}
14971497

14981498
if (unlikely(is_dl_boosted(dl_se) || !start_dl_timer(dl_se))) {
1499-
if (dl_server(dl_se))
1500-
enqueue_dl_entity(dl_se, ENQUEUE_REPLENISH);
1501-
else
1499+
if (dl_server(dl_se)) {
1500+
replenish_dl_new_period(dl_se, rq);
1501+
start_dl_timer(dl_se);
1502+
} else {
15021503
enqueue_task_dl(rq, dl_task_of(dl_se), ENQUEUE_REPLENISH);
1504+
}
15031505
}
15041506

15051507
if (!is_leftmost(dl_se, &rq->dl))
@@ -1611,7 +1613,7 @@ void dl_server_stop(struct sched_dl_entity *dl_se)
16111613
static bool dl_server_stopped(struct sched_dl_entity *dl_se)
16121614
{
16131615
if (!dl_se->dl_server_active)
1614-
return false;
1616+
return true;
16151617

16161618
if (dl_se->dl_server_idle) {
16171619
dl_server_stop(dl_se);
@@ -1849,7 +1851,9 @@ void inc_dl_tasks(struct sched_dl_entity *dl_se, struct dl_rq *dl_rq)
18491851
u64 deadline = dl_se->deadline;
18501852

18511853
dl_rq->dl_nr_running++;
1852-
add_nr_running(rq_of_dl_rq(dl_rq), 1);
1854+
1855+
if (!dl_server(dl_se))
1856+
add_nr_running(rq_of_dl_rq(dl_rq), 1);
18531857

18541858
inc_dl_deadline(dl_rq, deadline);
18551859
}
@@ -1859,7 +1863,9 @@ void dec_dl_tasks(struct sched_dl_entity *dl_se, struct dl_rq *dl_rq)
18591863
{
18601864
WARN_ON(!dl_rq->dl_nr_running);
18611865
dl_rq->dl_nr_running--;
1862-
sub_nr_running(rq_of_dl_rq(dl_rq), 1);
1866+
1867+
if (!dl_server(dl_se))
1868+
sub_nr_running(rq_of_dl_rq(dl_rq), 1);
18631869

18641870
dec_dl_deadline(dl_rq, dl_se->deadline);
18651871
}

kernel/sched/debug.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -376,10 +376,8 @@ static ssize_t sched_fair_server_write(struct file *filp, const char __user *ubu
376376
return -EINVAL;
377377
}
378378

379-
if (rq->cfs.h_nr_queued) {
380-
update_rq_clock(rq);
381-
dl_server_stop(&rq->fair_server);
382-
}
379+
update_rq_clock(rq);
380+
dl_server_stop(&rq->fair_server);
383381

384382
retval = dl_server_apply_params(&rq->fair_server, runtime, period, 0);
385383
if (retval)

0 commit comments

Comments
 (0)