sched/walt: add num_mvp_tasks for get the number of mvp task in walt rq

Add num_mvp_tasks for get the number of mvp task in walt rq.

Change-Id: I4367723cd61f7ee5fd63c2afcfefd6eb3258c118
Signed-off-by: Tengfei Fan <quic_tengfan@quicinc.com>
This commit is contained in:
Tengfei Fan 2021-12-21 17:45:15 +08:00 committed by Rishabh Bhatnagar
parent 8b663c22fb
commit 8c213b0ca3
3 changed files with 11 additions and 5 deletions

View File

@ -3834,6 +3834,7 @@ static void walt_sched_init_rq(struct rq *rq)
}
wrq->notif_pending = false;
wrq->num_mvp_tasks = 0;
INIT_LIST_HEAD(&wrq->mvp_tasks);
}
@ -4329,7 +4330,7 @@ static void walt_do_sched_yield(void *unused, struct rq *rq)
lockdep_assert_held(&rq->__lock);
if (!list_empty(&wts->mvp_list) && wts->mvp_list.next)
walt_cfs_deactivate_mvp_task(curr);
walt_cfs_deactivate_mvp_task(rq, curr);
if (per_cpu(rt_task_arrival_time, cpu_of(rq)))
per_cpu(rt_task_arrival_time, cpu_of(rq)) = 0;

View File

@ -121,6 +121,7 @@ struct walt_rq {
u64 last_cc_update;
u64 cycles;
struct list_head mvp_tasks;
int num_mvp_tasks;
u64 latest_clock;
};
@ -942,7 +943,7 @@ extern struct rq *__migrate_task(struct rq *rq, struct rq_flags *rf,
DECLARE_PER_CPU(u64, rt_task_arrival_time);
extern int walt_get_mvp_task_prio(struct task_struct *p);
extern void walt_cfs_deactivate_mvp_task(struct task_struct *p);
extern void walt_cfs_deactivate_mvp_task(struct rq *rq, struct task_struct *p);
enum WALT_DEBUG_FEAT {
WALT_BUG_UPSTREAM,

View File

@ -1064,14 +1064,17 @@ static void walt_cfs_insert_mvp_task(struct walt_rq *wrq, struct walt_task_struc
}
list_add(&wts->mvp_list, pos->prev);
wrq->num_mvp_tasks++;
}
void walt_cfs_deactivate_mvp_task(struct task_struct *p)
void walt_cfs_deactivate_mvp_task(struct rq *rq, struct task_struct *p)
{
struct walt_rq *wrq = (struct walt_rq *) rq->android_vendor_data1;
struct walt_task_struct *wts = (struct walt_task_struct *) p->android_vendor_data1;
list_del_init(&wts->mvp_list);
wts->mvp_prio = WALT_NOT_MVP;
wrq->num_mvp_tasks--;
}
/*
@ -1123,13 +1126,14 @@ static void walt_cfs_account_mvp_runtime(struct rq *rq, struct task_struct *curr
limit = walt_cfs_mvp_task_limit(curr);
if (wts->total_exec > limit) {
walt_cfs_deactivate_mvp_task(curr);
walt_cfs_deactivate_mvp_task(rq, curr);
trace_walt_cfs_deactivate_mvp_task(curr, wts, limit);
return;
}
/* slice expired. re-queue the task */
list_del(&wts->mvp_list);
wrq->num_mvp_tasks--;
walt_cfs_insert_mvp_task(wrq, wts, false);
}
@ -1169,7 +1173,7 @@ void walt_cfs_dequeue_task(struct rq *rq, struct task_struct *p)
struct walt_task_struct *wts = (struct walt_task_struct *) p->android_vendor_data1;
if (!list_empty(&wts->mvp_list) && wts->mvp_list.next)
walt_cfs_deactivate_mvp_task(p);
walt_cfs_deactivate_mvp_task(rq, p);
/*
* Reset the exec time during sleep so that it starts