linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] psi: fix possible missing or delayed pending event
@ 2022-09-19  7:23 Hao Lee
  2022-09-22  5:18 ` Suren Baghdasaryan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Hao Lee @ 2022-09-19  7:23 UTC (permalink / raw)
  To: hannes, surenb; +Cc: peterz, zhaoyang.huang, haolee.swjtu, linux-kernel

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")
Signed-off-by: Hao Lee <haolee.swjtu@gmail.com>
---
 kernel/sched/psi.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
index 9711827e3..7d305d0e0 100644
--- a/kernel/sched/psi.c
+++ b/kernel/sched/psi.c
@@ -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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] psi: fix possible missing or delayed pending event
  2022-09-19  7:23 [PATCH v2] psi: fix possible missing or delayed pending event Hao Lee
@ 2022-09-22  5:18 ` Suren Baghdasaryan
  2022-10-28  6:42 ` [tip: sched/core] sched/psi: Fix " tip-bot2 for Hao Lee
  2022-10-31 10:54 ` tip-bot2 for Hao Lee
  2 siblings, 0 replies; 4+ messages in thread
From: Suren Baghdasaryan @ 2022-09-22  5:18 UTC (permalink / raw)
  To: Hao Lee; +Cc: Johannes Weiner, Peter Zijlstra, Zhaoyang Huang, LKML

On Mon, Sep 19, 2022 at 12:23 AM Hao Lee <haolee.swjtu@gmail.com> wrote:
>
> 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")
> Signed-off-by: Hao Lee <haolee.swjtu@gmail.com>

Acked-by: Suren Baghdasaryan <surenb@google.com>

Thanks!

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip: sched/core] sched/psi: Fix possible missing or delayed pending event
  2022-09-19  7:23 [PATCH v2] psi: fix possible missing or delayed pending event Hao Lee
  2022-09-22  5:18 ` Suren Baghdasaryan
@ 2022-10-28  6:42 ` tip-bot2 for Hao Lee
  2022-10-31 10:54 ` tip-bot2 for Hao Lee
  2 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Hao Lee @ 2022-10-28  6:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Hao Lee, Peter Zijlstra (Intel), Suren Baghdasaryan, x86, linux-kernel

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 <haolee.swjtu@gmail.com>
AuthorDate:    Mon, 19 Sep 2022 07:23:56 
Committer:     Peter Zijlstra <peterz@infradead.org>
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")
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
---
 kernel/sched/psi.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
index f4cdf6f..dbaeac9 100644
--- a/kernel/sched/psi.c
+++ b/kernel/sched/psi.c
@@ -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)

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [tip: sched/core] sched/psi: Fix possible missing or delayed pending event
  2022-09-19  7:23 [PATCH v2] psi: fix possible missing or delayed pending event Hao Lee
  2022-09-22  5:18 ` Suren Baghdasaryan
  2022-10-28  6:42 ` [tip: sched/core] sched/psi: Fix " tip-bot2 for Hao Lee
@ 2022-10-31 10:54 ` tip-bot2 for Hao Lee
  2 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Hao Lee @ 2022-10-31 10:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Hao Lee, Peter Zijlstra (Intel), Suren Baghdasaryan, x86, linux-kernel

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 <haolee.swjtu@gmail.com>
AuthorDate:    Mon, 19 Sep 2022 07:23:56 
Committer:     Peter Zijlstra <peterz@infradead.org>
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")
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
---
 kernel/sched/psi.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
index ee2ecc0..7f40d87 100644
--- a/kernel/sched/psi.c
+++ b/kernel/sched/psi.c
@@ -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)

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-31 10:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-19  7:23 [PATCH v2] psi: fix possible missing or delayed pending event Hao Lee
2022-09-22  5:18 ` Suren Baghdasaryan
2022-10-28  6:42 ` [tip: sched/core] sched/psi: Fix " tip-bot2 for Hao Lee
2022-10-31 10:54 ` tip-bot2 for Hao Lee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).