Skip to content

Commit

Permalink
sched/psi: Fix possible missing or delayed pending event
Browse files Browse the repository at this point in the history
[ Upstream commit e38f89a ]

When a pending event exists and growth is less than the threshold, the
current logic is to skip this trigger without generating event. However,
from e6df4ea ("psi: fix possible trigger missing in the window"),
our purpose is to generate event as long as pending event exists and the
rate meets the limit, no matter what growth is.
This patch handles this case properly.

Fixes: e6df4ea ("psi: fix possible trigger missing in the window")
Signed-off-by: Hao Lee <haolee.swjtu@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Suren Baghdasaryan <surenb@google.com>
Link: https://lore.kernel.org/r/20220919072356.GA29069@haolee.io
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
hao-lee authored and gregkh committed Dec 31, 2022
1 parent 3878f60 commit 44de1ad
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions kernel/sched/psi.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,10 +539,12 @@ static u64 update_triggers(struct psi_group *group, u64 now)

/* Calculate growth since last update */
growth = window_update(&t->win, now, total[t->state]);
if (growth < t->threshold)
continue;
if (!t->pending_event) {
if (growth < t->threshold)
continue;

t->pending_event = true;
t->pending_event = true;
}
}
/* Limit event signaling to once per window */
if (now < t->last_event_time + t->win.size)
Expand Down

0 comments on commit 44de1ad

Please sign in to comment.