Skip to content

Commit 915a087

Browse files
suiya001Peter Zijlstra
authored andcommitted
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 <liuhailong@linux.alibaba.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Suren Baghdasaryan <surenb@google.com> Link: https://lore.kernel.org/r/1648789811-3788971-1-git-send-email-liuhailong@linux.alibaba.com
1 parent 089c02a commit 915a087

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

kernel/sched/psi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,8 @@ struct psi_trigger *psi_trigger_create(struct psi_group *group,
11171117
t->state = state;
11181118
t->threshold = threshold_us * NSEC_PER_USEC;
11191119
t->win.size = window_us * NSEC_PER_USEC;
1120-
window_reset(&t->win, 0, 0, 0);
1120+
window_reset(&t->win, sched_clock(),
1121+
group->total[PSI_POLL][t->state], 0);
11211122

11221123
t->event = 0;
11231124
t->last_event_time = 0;

0 commit comments

Comments
 (0)