Skip to contentSkip to conversation

psi: fix possible missing or delayed pending event

PATCH Applied Hao Lee 3 participants 4 messages Sep 19, 2022 – Oct 31, 2022

Subsystems (2)
lore
Share & tools
lore

Hao Lee

author
#0 lore raw

PATCH v2 1/1 psi: fix possible missing or delayed pending event

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 e6df4ead85d9 ("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 e6df4ead85d9 ("psi: fix possible trigger missing in the window")
---
 kernel/sched/psi.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
kernel/sched/psi.c +5 -3
index 9711827e3..7d305d0e0 100644
@@ -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)
Signature · 1 line
2.21.0
maintainer Acked-by on v2 1/1
#1 lore raw
Quoted 10 lines · Hao Lee

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 e6df4ead85d9 ("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 e6df4ead85d9 ("psi: fix possible trigger missing in the window")

Thanks!

Quoted 27 lines
---
 kernel/sched/psi.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
kernel/sched/psi.c +5 -4
index 9711827e3..7d305d0e0 100644
@@ -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)
--

2.21.0

merge bot Applied
#2 lore raw

[tip: sched/core] sched/psi: Fix possible missing or delayed pending event

In reply to Hao Lee
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:     c36eae5a86d15a694968be35d7ff056854997a72
Gitweb:        https://git.kernel.org/tip/c36eae5a86d15a694968be35d7ff056854997a72
Author:        Hao Lee <[email protected]>
AuthorDate:    Mon, 19 Sep 2022 07:23:56 
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Thu, 27 Oct 2022 11:01:23 +02:00

sched/psi: Fix possible missing or delayed pending event

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 e6df4ead85d9 ("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 e6df4ead85d9 ("psi: fix possible trigger missing in the window")
---
 kernel/sched/psi.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
kernel/sched/psi.c +5 -3
index f4cdf6f..dbaeac9 100644
@@ -554,10 +554,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)
merge bot Applied
#3 lore raw

[tip: sched/core] sched/psi: Fix possible missing or delayed pending event

In reply to Hao Lee
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:     e38f89af6a13e895805febd3a329a13ab7e66fa4
Gitweb:        https://git.kernel.org/tip/e38f89af6a13e895805febd3a329a13ab7e66fa4
Author:        Hao Lee <[email protected]>
AuthorDate:    Mon, 19 Sep 2022 07:23:56 
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Sun, 30 Oct 2022 10:12:13 +01:00

sched/psi: Fix possible missing or delayed pending event

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 e6df4ead85d9 ("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 e6df4ead85d9 ("psi: fix possible trigger missing in the window")
---
 kernel/sched/psi.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
kernel/sched/psi.c +5 -3
index ee2ecc0..7f40d87 100644
@@ -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)