sched/walt: Deal with mvp_list at the very initial stage

When the android vendor hook is not registered yet, there
is already tasks. And if those kind of tasks being killed
without any wakeup after vendor hook registered, it will
be a NULL referenced data.

Change-Id: Ied2eb3805dd01740a01707e2016c24a4648b1b25
Signed-off-by: Maria Yu <quic_aiquny@quicinc.com>
This commit is contained in:
Maria Yu 2021-11-24 15:31:25 +08:00 committed by Rishabh Bhatnagar
parent f499ceb734
commit 0c44eb86b4

View File

@ -1148,7 +1148,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))
if (!list_empty(&wts->mvp_list) && wts->mvp_list.next)
walt_cfs_deactivate_mvp_task(p);
/*
@ -1171,7 +1171,7 @@ void walt_cfs_tick(struct rq *rq)
raw_spin_lock(&rq->__lock);
if (list_empty(&wts->mvp_list))
if (list_empty(&wts->mvp_list) || (wts->mvp_list.next == NULL))
goto out;
walt_cfs_account_mvp_runtime(rq, rq->curr);
@ -1205,8 +1205,8 @@ static void walt_cfs_check_preempt_wakeup(void *unused, struct rq *rq, struct ta
if (unlikely(walt_disabled))
return;
p_is_mvp = !list_empty(&wts_p->mvp_list);
curr_is_mvp = !list_empty(&wts_c->mvp_list);
p_is_mvp = !list_empty(&wts_p->mvp_list) && wts_p->mvp_list.next;
curr_is_mvp = !list_empty(&wts_c->mvp_list) && wts_c->mvp_list.next;
/*
* current is not MVP, so preemption decision