From: Hailong Liu Date: Fri, 1 Apr 2022 05:10:11 +0000 (+0800) Subject: psi: Fix trigger being fired unexpectedly at initial X-Git-Tag: v6.6.17~7504^2~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=915a087e4c47334a2f7ba2a4092c4bade0873769;p=platform%2Fkernel%2Flinux-rpi.git psi: Fix trigger being fired unexpectedly at initial When a trigger being created, its win.start_value and win.start_time are reset to zero. If group->total[PSI_POLL][t->state] has accumulated before, this trigger will be fired unexpectedly in the next period, even if its growth time does not reach its threshold. So set the window of the new trigger to the current state value. Signed-off-by: Hailong Liu Signed-off-by: Peter Zijlstra (Intel) Acked-by: Suren Baghdasaryan Link: https://lore.kernel.org/r/1648789811-3788971-1-git-send-email-liuhailong@linux.alibaba.com --- diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c index a4fa3aa..5a49a8c 100644 --- a/kernel/sched/psi.c +++ b/kernel/sched/psi.c @@ -1117,7 +1117,8 @@ struct psi_trigger *psi_trigger_create(struct psi_group *group, t->state = state; t->threshold = threshold_us * NSEC_PER_USEC; t->win.size = window_us * NSEC_PER_USEC; - window_reset(&t->win, 0, 0, 0); + window_reset(&t->win, sched_clock(), + group->total[PSI_POLL][t->state], 0); t->event = 0; t->last_event_time = 0;