sched/walt: handle misaligned task window start

Introduce awareness for task window start and identify if task
window_start doesn't match that of the CPUs just before accounting.

Change-Id: I58d806e2a75bc647dc28b1f95d00352d29c5c447
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
This commit is contained in:
Shaleen Agrawal 2022-04-22 12:53:52 -07:00 committed by Rishabh Bhatnagar
parent 421ed6261a
commit 2fc529c88a
2 changed files with 32 additions and 2 deletions

View File

@ -100,6 +100,7 @@ struct walt_task_struct {
* 0 = nothing, 1 = enqueued, 2 = dequeued
*/
u64 mark_start;
u64 window_start;
u32 sum, demand;
u32 coloc_demand;
u32 sum_history[RAVG_HIST_SIZE];

View File

@ -1121,6 +1121,17 @@ static void fixup_busy_time(struct task_struct *p, int new_cpu)
old_window_start = update_window_start(dest_rq, wallclock, TASK_UPDATE);
run_walt_irq_work_rollover(old_window_start, dest_rq);
if (wts->window_start != src_wrq->window_start)
WALT_BUG(WALT_BUG_WALT, p,
"CPU%d: %s task %s(%d)'s ws=%llu not equal to src_rq %d's ws=%llu",
__func__, raw_smp_processor_id(), p->comm, p->pid,
wts->window_start, src_rq->cpu, src_wrq->window_start);
if (wts->window_start != dest_wrq->window_start)
WALT_BUG(WALT_BUG_WALT, p,
"CPU%d: %s task %s(%d)'s ws=%llu not equal to dest_rq %d's ws=%llu",
__func__, raw_smp_processor_id(), p->comm, p->pid,
wts->window_start, dest_rq->cpu, dest_wrq->window_start);
update_task_cpu_cycles(p, new_cpu, wallclock);
new_task = is_new_task(p);
@ -1715,9 +1726,10 @@ static void update_cpu_busy_time(struct task_struct *p, struct rq *rq,
* Handle per-task window rollover. We don't care about the
* idle task.
*/
if (!is_idle_task(p)) {
if (new_window)
if (new_window) {
if (!is_idle_task(p))
rollover_task_window(p, full_window);
wts->window_start = window_start;
}
new_task = is_new_task(p);
@ -1736,6 +1748,12 @@ static void update_cpu_busy_time(struct task_struct *p, struct rq *rq,
nt_prev_runnable_sum = &cpu_time->nt_prev_runnable_sum;
}
if (wts->window_start != wrq->window_start)
WALT_BUG(WALT_BUG_WALT, p,
"CPU%d: %s task %s(%d)'s ws=%llu not equal to rq %d's ws=%llu",
__func__, raw_smp_processor_id(), p->comm, p->pid,
wts->window_start, rq->cpu, wrq->window_start);
if (!new_window) {
/*
* account_busy_for_cpu_time() = 1 so busy time needs
@ -2302,6 +2320,9 @@ static void walt_update_task_ravg(struct task_struct *p, struct rq *rq, int even
old_window_start = update_window_start(rq, wallclock, event);
if (!wts->window_start)
wts->window_start = wrq->window_start;
if (!wts->mark_start) {
update_task_cpu_cycles(p, cpu_of(rq), wallclock);
goto done;
@ -2355,6 +2376,7 @@ static void init_new_task_load(struct task_struct *p)
INIT_LIST_HEAD(&wts->grp_list);
wts->mark_start = 0;
wts->window_start = 0;
wts->sum = 0;
wts->curr_window = 0;
wts->prev_window = 0;
@ -3332,6 +3354,13 @@ static void transfer_busy_time(struct rq *rq,
wallclock = walt_sched_clock();
walt_update_task_ravg(p, rq, TASK_UPDATE, wallclock, 0);
if (wts->window_start != wrq->window_start)
WALT_BUG(WALT_BUG_WALT, p,
"CPU%d: %s event=%d task %s(%d)'s ws=%llu not equal to rq %d's ws=%llu",
__func__, raw_smp_processor_id(), event, p->comm, p->pid,
wts->window_start, rq->cpu, wrq->window_start);
new_task = is_new_task(p);
cpu_time = &wrq->grp_time;