return growth;
}
-static u64 update_triggers(struct psi_group *group, u64 now)
+static u64 update_triggers(struct psi_group *group, u64 now, bool *update_total)
{
struct psi_trigger *t;
- bool update_total = false;
u64 *total = group->total[PSI_POLL];
+ *update_total = false;
/*
* On subsequent updates, calculate growth deltas and let
* been through all of them. Also remember to extend the
* polling time if we see new stall activity.
*/
- update_total = true;
+ *update_total = true;
/* Calculate growth since last update */
growth = window_update(&t->win, now, total[t->state]);
t->pending_event = false;
}
- if (update_total)
- memcpy(group->rtpoll_total, total,
- sizeof(group->rtpoll_total));
-
return now + group->rtpoll_min_period;
}
{
bool force_reschedule = false;
u32 changed_states;
+ bool update_total;
u64 now;
mutex_lock(&group->rtpoll_trigger_lock);
goto out;
}
- if (now >= group->rtpoll_next_update)
- group->rtpoll_next_update = update_triggers(group, now);
+ if (now >= group->rtpoll_next_update) {
+ group->rtpoll_next_update = update_triggers(group, now, &update_total);
+ if (update_total)
+ memcpy(group->rtpoll_total, group->total[PSI_POLL],
+ sizeof(group->rtpoll_total));
+ }
psi_schedule_rtpoll_work(group,
nsecs_to_jiffies(group->rtpoll_next_update - now) + 1,