kernel/sched/walt: validate runqueue entries

Instead of traversing the entire process list
to determine if there are any tasks left on
this cpu's rq, track any tasks that get
re-enqueued during the balance_callbacks
operation.

Change-Id: Iff8322172b17c98c2c6b2a8f75653f557cebcbb6
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
This commit is contained in:
Stephen Dickey 2022-07-29 15:46:52 -07:00 committed by Sai Harshini Nimmala
parent f6c65099e9
commit d5e0c218f3
3 changed files with 9 additions and 0 deletions

View File

@ -4146,6 +4146,7 @@ static void android_rvh_enqueue_task(void *unused, struct rq *rq, struct task_st
{
u64 wallclock;
struct walt_task_struct *wts = (struct walt_task_struct *) p->android_vendor_data1;
struct walt_rq *wrq = (struct walt_rq *) rq->android_vendor_data1;
bool double_enqueue = false;
if (unlikely(walt_disabled))
@ -4153,6 +4154,9 @@ static void android_rvh_enqueue_task(void *unused, struct rq *rq, struct task_st
lockdep_assert_held(&rq->__lock);
if (!is_per_cpu_kthread(p))
wrq->enqueue_counter++;
if (p->cpu != cpu_of(rq))
WALT_BUG(WALT_BUG_UPSTREAM, p, "enqueuing on rq %d when task->cpu is %d\n",
cpu_of(rq), p->cpu);

View File

@ -125,6 +125,7 @@ struct walt_rq {
struct list_head mvp_tasks;
int num_mvp_tasks;
u64 latest_clock;
u32 enqueue_counter;
};
struct walt_sched_cluster {

View File

@ -182,6 +182,7 @@ static int drain_rq_cpu_stop(void *data)
{
struct rq *rq = this_rq();
struct rq_flags rf;
struct walt_rq *wrq = (struct walt_rq *) rq->android_vendor_data1;
rq_lock_irqsave(rq, &rf);
migrate_tasks(rq, &rf);
@ -191,7 +192,10 @@ static int drain_rq_cpu_stop(void *data)
* any subsequent calls to rq_lock... will see an rq->balance_callback set to
* the default (0 or balance_push_callback);
*/
wrq->enqueue_counter = 0;
__balance_callbacks(rq);
if (wrq->enqueue_counter)
WALT_BUG(WALT_BUG_WALT, NULL, "cpu: %d task was re-enqueued", cpu_of(rq));
rq_unlock_irqrestore(rq, &rf);