Skip to contentSkip to conversation

psi: fix possible trigger missing in the window

PATCH Applied Huangzhaoyang 5 participants 6 messages Jan 25, 2022 – Feb 17, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 psi: fix possible trigger missing in the window

From: Zhaoyang Huang <[email protected]>

When a new threshold breaching stall happens after a psi event was generated and within the window duration, the new event is not generated because the events are rate-limited to one per window. If after that no new stall is recorded then the event will not be generated even after rate-limiting duration has passed. This is happening because with no new stall, window_update will not be called even though threshold was previously breached. To fix this, record threshold breaching occurrence and generate the event once window duration is passed.

---
v2: modify the logic according to Suren's suggestion
v3: update commit message
v4: update variable name and comments
---

---
 include/linux/psi_types.h |  3 +++
 kernel/sched/psi.c        | 46 ++++++++++++++++++++++++++++++----------------
 2 files changed, 33 insertions(+), 16 deletions(-)
include/linux/psi_types.h +3 -0
index 0a23300..e0ec129 100644
@@ -132,6 +132,9 @@ struct psi_trigger {
 
 	/* Refcounting to prevent premature destruction */
 	struct kref refcount;
+
+	/* Deferred event(s) from previous ratelimit window */
+	bool pending_event;
 };
 
 struct psi_group {
kernel/sched/psi.c +30 -16

76 lines not on this page · raw message

Signature · 1 line
1.9.1
maintainer Acked-by on v4 1/1
#1 lore raw
Quoted 12 lines · Huangzhaoyang

From: Zhaoyang Huang <[email protected]>

When a new threshold breaching stall happens after a psi event was generated and within the window duration, the new event is not generated because the events are rate-limited to one per window. If after that no new stall is recorded then the event will not be generated even after rate-limiting duration has passed. This is happening because with no new stall, window_update will not be called even though threshold was previously breached. To fix this, record threshold breaching occurrence and generate the event once window duration is passed.

Quoted 2 lines
maintainer Acked-by
#2 lore raw
Quoted 14 lines · Johannes Weiner
Quoted 12 lines · Huangzhaoyang

From: Zhaoyang Huang <[email protected]>

When a new threshold breaching stall happens after a psi event was generated and within the window duration, the new event is not generated because the events are rate-limited to one per window. If after that no new stall is recorded then the event will not be generated even after rate-limiting duration has passed. This is happening because with no new stall, window_update will not be called even though threshold was previously breached. To fix this, record threshold breaching occurrence and generate the event once window duration is passed.

Quoted 4 lines
Quoted 2 lines

Looks good. Thanks!

maintainer
#3 lore raw
In reply to Huangzhaoyang
Quoted 12 lines · Huangzhaoyang

From: Zhaoyang Huang <[email protected]>

When a new threshold breaching stall happens after a psi event was generated and within the window duration, the new event is not generated because the events are rate-limited to one per window. If after that no new stall is recorded then the event will not be generated even after rate-limiting duration has passed. This is happening because with no new stall, window_update will not be called even though threshold was previously breached. To fix this, record threshold breaching occurrence and generate the event once window duration is passed.

Quoted 2 lines

Hey Peter, would you mind taking this through the scheduler tree? It's got my and Suren's acks. It's not a recent regression so I'm thinking for 5.18 is fine. Thanks!

maintainer
#4 lore raw
Quoted 13 lines · Johannes Weiner
Quoted 12 lines · Huangzhaoyang

From: Zhaoyang Huang <[email protected]>

When a new threshold breaching stall happens after a psi event was generated and within the window duration, the new event is not generated because the events are rate-limited to one per window. If after that no new stall is recorded then the event will not be generated even after rate-limiting duration has passed. This is happening because with no new stall, window_update will not be called even though threshold was previously breached. To fix this, record threshold breaching occurrence and generate the event once window duration is passed.

Quoted 6 lines
Quoted 2 lines

Hey Peter, would you mind taking this through the scheduler tree? It's got my and Suren's acks. It's not a recent regression so I'm thinking for 5.18 is fine. Thanks!

Sorry, missed it, got it now. Thanks!

merge bot Applied
#5 lore raw
In reply to Huangzhaoyang
The following commit has been merged into the sched/core branch of tip:

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     e6df4ead85d9da1b07dd40bd4c6d2182f3e210c4
Gitweb:        https://git.kernel.org/tip/e6df4ead85d9da1b07dd40bd4c6d2182f3e210c4
Author:        Zhaoyang Huang <[email protected]>
AuthorDate:    Tue, 25 Jan 2022 14:56:58 +08:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Wed, 16 Feb 2022 15:57:54 +01:00

psi: fix possible trigger missing in the window

When a new threshold breaching stall happens after a psi event was generated and within the window duration, the new event is not generated because the events are rate-limited to one per window. If after that no new stall is recorded then the event will not be generated even after rate-limiting duration has passed. This is happening because with no new stall, window_update will not be called even though threshold was previously breached. To fix this, record threshold breaching occurrence and generate the event once window duration is passed.

---
 include/linux/psi_types.h |  3 ++-
 kernel/sched/psi.c        | 46 ++++++++++++++++++++++++--------------
 2 files changed, 33 insertions(+), 16 deletions(-)
include/linux/psi_types.h +3 -0
index 516c0fe..dc3ec5e 100644
@@ -144,6 +144,9 @@ struct psi_trigger {
 
 	/* Refcounting to prevent premature destruction */
 	struct kref refcount;
+
+	/* Deferred event(s) from previous ratelimit window */
+	bool pending_event;
 };
 
 struct psi_group {
kernel/sched/psi.c +30 -16

76 lines not on this page · raw message