mirror of
https://github.com/torvalds/linux.git
synced 2026-07-31 03:27:03 +02:00
sched/walt: Add fair task check in tick path load balance
The tick path load balance is meant for fair tasks. Add a check for the same before considering the task for migration. The fair_policy() check alone does not work as it returns true for idle task and also for RT boosted tasks. Add a wrapper based on priority check. Change-Id: I05cc996cb15051e4f6bb1a73005234e4d5188d19 Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
This commit is contained in:
parent
9159c2eef9
commit
eed86c5eb2
|
|
@ -3752,7 +3752,7 @@ static void android_rvh_enqueue_task(void *unused, struct rq *rq, struct task_st
|
|||
wts->last_enqueued_ts = wallclock;
|
||||
sched_update_nr_prod(rq->cpu, true);
|
||||
|
||||
if (fair_policy(p->policy)) {
|
||||
if (walt_fair_task(p)) {
|
||||
wts->misfit = !task_fits_max(p, rq->cpu);
|
||||
inc_rq_walt_stats(rq, p);
|
||||
}
|
||||
|
|
@ -3772,7 +3772,7 @@ static void android_rvh_dequeue_task(void *unused, struct rq *rq, struct task_st
|
|||
|
||||
sched_update_nr_prod(rq->cpu, false);
|
||||
|
||||
if (fair_policy(p->policy))
|
||||
if (walt_fair_task(p))
|
||||
dec_rq_walt_stats(rq, p);
|
||||
|
||||
walt_dec_cumulative_runnable_avg(rq, p);
|
||||
|
|
|
|||
|
|
@ -858,4 +858,13 @@ static inline struct task_group *css_tg(struct cgroup_subsys_state *css)
|
|||
return css ? container_of(css, struct task_group, css) : NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* The policy of a RT boosted task (via PI mutex) still indicates it is
|
||||
* a fair task, so use prio check as well. The prio check alone is not
|
||||
* sufficient since idle task also has 120 priority.
|
||||
*/
|
||||
static inline bool walt_fair_task(struct task_struct *p)
|
||||
{
|
||||
return p->prio >= MAX_RT_PRIO && !is_idle_task(p);
|
||||
}
|
||||
#endif /* _WALT_H */
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ static void walt_lb_check_for_rotation(struct rq *src_rq)
|
|||
if (is_reserved(i))
|
||||
continue;
|
||||
|
||||
if (!rq->misfit_task_load)
|
||||
if (!rq->misfit_task_load || !walt_fair_task(rq->curr))
|
||||
continue;
|
||||
|
||||
wts = (struct walt_task_struct *) rq->curr->android_vendor_data1;
|
||||
|
|
@ -167,7 +167,7 @@ static void walt_lb_check_for_rotation(struct rq *src_rq)
|
|||
if (is_reserved(i))
|
||||
continue;
|
||||
|
||||
if (rq->curr->prio < MAX_RT_PRIO)
|
||||
if (!walt_fair_task(rq->curr))
|
||||
continue;
|
||||
|
||||
if (rq->nr_running > 1)
|
||||
|
|
@ -191,8 +191,7 @@ static void walt_lb_check_for_rotation(struct rq *src_rq)
|
|||
dst_rq = cpu_rq(dst_cpu);
|
||||
|
||||
double_rq_lock(src_rq, dst_rq);
|
||||
if (dst_rq->curr->prio >= MAX_RT_PRIO && dst_rq->curr != dst_rq->idle &&
|
||||
src_rq->curr->prio >= MAX_RT_PRIO && src_rq->curr != src_rq->idle) {
|
||||
if (walt_fair_task(dst_rq->curr)) {
|
||||
get_task_struct(src_rq->curr);
|
||||
get_task_struct(dst_rq->curr);
|
||||
|
||||
|
|
@ -494,7 +493,7 @@ static void walt_lb_tick(void *unused, struct rq *rq)
|
|||
|
||||
if (static_branch_unlikely(&walt_disabled))
|
||||
return;
|
||||
if (!rq->misfit_task_load)
|
||||
if (!rq->misfit_task_load || !walt_fair_task(p))
|
||||
return;
|
||||
|
||||
if (p->state != TASK_RUNNING || p->nr_cpus_allowed == 1)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user