mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
sched: deadline: Add some helper variables to cleanup deadline logic
As part of an improvement to handling pushable deadline tasks, Peter suggested this cleanup[1], to use helper values for dl_entity and dl_rq in the enqueue_task_dl() and put_prev_task_dl() functions. There should be no functional change from this patch. To make sure this cleanup change doesn't obscure later logic changes, I've split it into its own patch. [1]: https://lore.kernel.org/lkml/20260304095123.GP606826@noisy.programming.kicks-ass.net/ Suggested-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: John Stultz <jstultz@google.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://patch.msgid.link/20260512025635.2840817-3-jstultz@google.com
This commit is contained in:
parent
7a3a6bfbd6
commit
96a6988fb5
|
|
@ -2484,7 +2484,10 @@ static void dequeue_dl_entity(struct sched_dl_entity *dl_se, int flags)
|
|||
|
||||
static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags)
|
||||
{
|
||||
if (is_dl_boosted(&p->dl)) {
|
||||
struct sched_dl_entity *dl_se = &p->dl;
|
||||
struct dl_rq *dl_rq = &rq->dl;
|
||||
|
||||
if (is_dl_boosted(dl_se)) {
|
||||
/*
|
||||
* Because of delays in the detection of the overrun of a
|
||||
* thread's runtime, it might be the case that a thread
|
||||
|
|
@ -2497,14 +2500,14 @@ static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags)
|
|||
*
|
||||
* In this case, the boost overrides the throttle.
|
||||
*/
|
||||
if (p->dl.dl_throttled) {
|
||||
if (dl_se->dl_throttled) {
|
||||
/*
|
||||
* The replenish timer needs to be canceled. No
|
||||
* problem if it fires concurrently: boosted threads
|
||||
* are ignored in dl_task_timer().
|
||||
*/
|
||||
cancel_replenish_timer(&p->dl);
|
||||
p->dl.dl_throttled = 0;
|
||||
cancel_replenish_timer(dl_se);
|
||||
dl_se->dl_throttled = 0;
|
||||
}
|
||||
} else if (!dl_prio(p->normal_prio)) {
|
||||
/*
|
||||
|
|
@ -2516,7 +2519,7 @@ static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags)
|
|||
* being boosted again with no means to replenish the runtime and clear
|
||||
* the throttle.
|
||||
*/
|
||||
p->dl.dl_throttled = 0;
|
||||
dl_se->dl_throttled = 0;
|
||||
if (!(flags & ENQUEUE_REPLENISH))
|
||||
printk_deferred_once("sched: DL de-boosted task PID %d: REPLENISH flag missing\n",
|
||||
task_pid_nr(p));
|
||||
|
|
@ -2525,20 +2528,20 @@ static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags)
|
|||
}
|
||||
|
||||
check_schedstat_required();
|
||||
update_stats_wait_start_dl(dl_rq_of_se(&p->dl), &p->dl);
|
||||
update_stats_wait_start_dl(dl_rq, dl_se);
|
||||
|
||||
if (p->on_rq == TASK_ON_RQ_MIGRATING)
|
||||
flags |= ENQUEUE_MIGRATING;
|
||||
|
||||
enqueue_dl_entity(&p->dl, flags);
|
||||
enqueue_dl_entity(dl_se, flags);
|
||||
|
||||
if (dl_server(&p->dl))
|
||||
if (dl_server(dl_se))
|
||||
return;
|
||||
|
||||
if (task_is_blocked(p))
|
||||
return;
|
||||
|
||||
if (!task_current(rq, p) && !p->dl.dl_throttled && p->nr_cpus_allowed > 1)
|
||||
if (!task_current(rq, p) && !dl_se->dl_throttled && p->nr_cpus_allowed > 1)
|
||||
enqueue_pushable_dl_task(rq, p);
|
||||
}
|
||||
|
||||
|
|
@ -2835,7 +2838,7 @@ static void put_prev_task_dl(struct rq *rq, struct task_struct *p, struct task_s
|
|||
struct sched_dl_entity *dl_se = &p->dl;
|
||||
struct dl_rq *dl_rq = &rq->dl;
|
||||
|
||||
if (on_dl_rq(&p->dl))
|
||||
if (on_dl_rq(dl_se))
|
||||
update_stats_wait_start_dl(dl_rq, dl_se);
|
||||
|
||||
update_curr_dl(rq);
|
||||
|
|
@ -2845,7 +2848,7 @@ static void put_prev_task_dl(struct rq *rq, struct task_struct *p, struct task_s
|
|||
if (task_is_blocked(p))
|
||||
return;
|
||||
|
||||
if (on_dl_rq(&p->dl) && p->nr_cpus_allowed > 1)
|
||||
if (on_dl_rq(dl_se) && p->nr_cpus_allowed > 1)
|
||||
enqueue_pushable_dl_task(rq, p);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user