mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-07-05 13:25:20 +02:00
sched: Fixup set_next_task() implementations
The rule is that: pick_next_task() := pick_task() + set_next_task(.first = true) Turns out, there's still a few things in pick_next_task() that are missing from that combination. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20240813224015.724111109@infradead.org
This commit is contained in:
parent
7d2180d9d9
commit
dae4320b29
|
@ -2386,6 +2386,9 @@ static void set_next_task_dl(struct rq *rq, struct task_struct *p, bool first)
|
||||||
update_dl_rq_load_avg(rq_clock_pelt(rq), rq, 0);
|
update_dl_rq_load_avg(rq_clock_pelt(rq), rq, 0);
|
||||||
|
|
||||||
deadline_queue_push_tasks(rq);
|
deadline_queue_push_tasks(rq);
|
||||||
|
|
||||||
|
if (hrtick_enabled(rq))
|
||||||
|
start_hrtick_dl(rq, &p->dl);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct sched_dl_entity *pick_next_dl_entity(struct dl_rq *dl_rq)
|
static struct sched_dl_entity *pick_next_dl_entity(struct dl_rq *dl_rq)
|
||||||
|
@ -2452,9 +2455,6 @@ static struct task_struct *pick_next_task_dl(struct rq *rq)
|
||||||
if (!p->dl_server)
|
if (!p->dl_server)
|
||||||
set_next_task_dl(rq, p, true);
|
set_next_task_dl(rq, p, true);
|
||||||
|
|
||||||
if (hrtick_enabled(rq))
|
|
||||||
start_hrtick_dl(rq, &p->dl);
|
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8760,6 +8760,9 @@ again:
|
||||||
return task_of(se);
|
return task_of(se);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void __set_next_task_fair(struct rq *rq, struct task_struct *p, bool first);
|
||||||
|
static void set_next_task_fair(struct rq *rq, struct task_struct *p, bool first);
|
||||||
|
|
||||||
struct task_struct *
|
struct task_struct *
|
||||||
pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
|
pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
|
||||||
{
|
{
|
||||||
|
@ -8808,33 +8811,17 @@ again:
|
||||||
|
|
||||||
put_prev_entity(cfs_rq, pse);
|
put_prev_entity(cfs_rq, pse);
|
||||||
set_next_entity(cfs_rq, se);
|
set_next_entity(cfs_rq, se);
|
||||||
|
|
||||||
|
__set_next_task_fair(rq, p, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
goto done;
|
return p;
|
||||||
|
|
||||||
simple:
|
simple:
|
||||||
#endif
|
#endif
|
||||||
if (prev)
|
if (prev)
|
||||||
put_prev_task(rq, prev);
|
put_prev_task(rq, prev);
|
||||||
|
set_next_task_fair(rq, p, true);
|
||||||
for_each_sched_entity(se)
|
|
||||||
set_next_entity(cfs_rq_of(se), se);
|
|
||||||
|
|
||||||
done: __maybe_unused;
|
|
||||||
#ifdef CONFIG_SMP
|
|
||||||
/*
|
|
||||||
* Move the next running task to the front of
|
|
||||||
* the list, so our cfs_tasks list becomes MRU
|
|
||||||
* one.
|
|
||||||
*/
|
|
||||||
list_move(&p->se.group_node, &rq->cfs_tasks);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (hrtick_enabled_fair(rq))
|
|
||||||
hrtick_start_fair(rq, p);
|
|
||||||
|
|
||||||
update_misfit_status(p, rq);
|
|
||||||
sched_fair_update_stop_tick(rq, p);
|
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
|
|
||||||
idle:
|
idle:
|
||||||
|
@ -13145,12 +13132,7 @@ static void switched_to_fair(struct rq *rq, struct task_struct *p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Account for a task changing its policy or group.
|
static void __set_next_task_fair(struct rq *rq, struct task_struct *p, bool first)
|
||||||
*
|
|
||||||
* This routine is mostly called to set cfs_rq->curr field when a task
|
|
||||||
* migrates between groups/classes.
|
|
||||||
*/
|
|
||||||
static void set_next_task_fair(struct rq *rq, struct task_struct *p, bool first)
|
|
||||||
{
|
{
|
||||||
struct sched_entity *se = &p->se;
|
struct sched_entity *se = &p->se;
|
||||||
|
|
||||||
|
@ -13163,6 +13145,27 @@ static void set_next_task_fair(struct rq *rq, struct task_struct *p, bool first)
|
||||||
list_move(&se->group_node, &rq->cfs_tasks);
|
list_move(&se->group_node, &rq->cfs_tasks);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if (!first)
|
||||||
|
return;
|
||||||
|
|
||||||
|
SCHED_WARN_ON(se->sched_delayed);
|
||||||
|
|
||||||
|
if (hrtick_enabled_fair(rq))
|
||||||
|
hrtick_start_fair(rq, p);
|
||||||
|
|
||||||
|
update_misfit_status(p, rq);
|
||||||
|
sched_fair_update_stop_tick(rq, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Account for a task changing its policy or group.
|
||||||
|
*
|
||||||
|
* This routine is mostly called to set cfs_rq->curr field when a task
|
||||||
|
* migrates between groups/classes.
|
||||||
|
*/
|
||||||
|
static void set_next_task_fair(struct rq *rq, struct task_struct *p, bool first)
|
||||||
|
{
|
||||||
|
struct sched_entity *se = &p->se;
|
||||||
|
|
||||||
for_each_sched_entity(se) {
|
for_each_sched_entity(se) {
|
||||||
struct cfs_rq *cfs_rq = cfs_rq_of(se);
|
struct cfs_rq *cfs_rq = cfs_rq_of(se);
|
||||||
|
@ -13172,10 +13175,7 @@ static void set_next_task_fair(struct rq *rq, struct task_struct *p, bool first)
|
||||||
account_cfs_rq_runtime(cfs_rq, 0);
|
account_cfs_rq_runtime(cfs_rq, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!first)
|
__set_next_task_fair(rq, p, first);
|
||||||
return;
|
|
||||||
|
|
||||||
SCHED_WARN_ON(se->sched_delayed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_cfs_rq(struct cfs_rq *cfs_rq)
|
void init_cfs_rq(struct cfs_rq *cfs_rq)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user