* [PATCH] psi: Fix trigger being fired unexpectedly at initial
@ 2022-04-01 5:10 Hailong Liu
2022-04-01 16:19 ` Suren Baghdasaryan
2022-04-22 10:27 ` [tip: sched/core] " tip-bot2 for Hailong Liu
0 siblings, 2 replies; 4+ messages in thread
From: Hailong Liu @ 2022-04-01 5:10 UTC (permalink / raw)
To: Johannes Weiner, Suren Baghdasaryan
Cc: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
aniel Bristot de Oliveira, linux-kernel, Hailong Liu
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>
---
kernel/sched/psi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
index a4fa3aadfcba..5a49a8c8783e 100644
--- a/kernel/sched/psi.c
+++ b/kernel/sched/psi.c
@@ -1117,7 +1117,8 @@ struct psi_trigger *psi_trigger_create(struct psi_group *group,
t->state = state;
t->threshold = threshold_us * NSEC_PER_USEC;
t->win.size = window_us * NSEC_PER_USEC;
- window_reset(&t->win, 0, 0, 0);
+ window_reset(&t->win, sched_clock(),
+ group->total[PSI_POLL][t->state], 0);
t->event = 0;
t->last_event_time = 0;
--
2.19.1.6.gb485710b
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] psi: Fix trigger being fired unexpectedly at initial
2022-04-01 5:10 [PATCH] psi: Fix trigger being fired unexpectedly at initial Hailong Liu
@ 2022-04-01 16:19 ` Suren Baghdasaryan
2022-04-06 11:11 ` Peter Zijlstra
2022-04-22 10:27 ` [tip: sched/core] " tip-bot2 for Hailong Liu
1 sibling, 1 reply; 4+ messages in thread
From: Suren Baghdasaryan @ 2022-04-01 16:19 UTC (permalink / raw)
To: Hailong Liu
Cc: Johannes Weiner, Ingo Molnar, Peter Zijlstra, Juri Lelli,
Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
Mel Gorman, aniel Bristot de Oliveira, LKML
On Thu, Mar 31, 2022 at 10:10 PM Hailong Liu
<liuhailong@linux.alibaba.com> wrote:
>
> 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.
Makes sense to me. Thanks!
>
> Signed-off-by: Hailong Liu <liuhailong@linux.alibaba.com>
Acked-by: Suren Baghdasaryan <surenb@google.com>
> ---
> kernel/sched/psi.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
> index a4fa3aadfcba..5a49a8c8783e 100644
> --- a/kernel/sched/psi.c
> +++ b/kernel/sched/psi.c
> @@ -1117,7 +1117,8 @@ struct psi_trigger *psi_trigger_create(struct psi_group *group,
> t->state = state;
> t->threshold = threshold_us * NSEC_PER_USEC;
> t->win.size = window_us * NSEC_PER_USEC;
> - window_reset(&t->win, 0, 0, 0);
> + window_reset(&t->win, sched_clock(),
> + group->total[PSI_POLL][t->state], 0);
>
> t->event = 0;
> t->last_event_time = 0;
> --
> 2.19.1.6.gb485710b
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] psi: Fix trigger being fired unexpectedly at initial
2022-04-01 16:19 ` Suren Baghdasaryan
@ 2022-04-06 11:11 ` Peter Zijlstra
0 siblings, 0 replies; 4+ messages in thread
From: Peter Zijlstra @ 2022-04-06 11:11 UTC (permalink / raw)
To: Suren Baghdasaryan
Cc: Hailong Liu, Johannes Weiner, Ingo Molnar, Juri Lelli,
Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
Mel Gorman, aniel Bristot de Oliveira, LKML
On Fri, Apr 01, 2022 at 09:19:17AM -0700, Suren Baghdasaryan wrote:
> On Thu, Mar 31, 2022 at 10:10 PM Hailong Liu
> <liuhailong@linux.alibaba.com> wrote:
> >
> > 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.
>
> Makes sense to me. Thanks!
>
> >
> > Signed-off-by: Hailong Liu <liuhailong@linux.alibaba.com>
>
> Acked-by: Suren Baghdasaryan <surenb@google.com>
Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip: sched/core] psi: Fix trigger being fired unexpectedly at initial
2022-04-01 5:10 [PATCH] psi: Fix trigger being fired unexpectedly at initial Hailong Liu
2022-04-01 16:19 ` Suren Baghdasaryan
@ 2022-04-22 10:27 ` tip-bot2 for Hailong Liu
1 sibling, 0 replies; 4+ messages in thread
From: tip-bot2 for Hailong Liu @ 2022-04-22 10:27 UTC (permalink / raw)
To: linux-tip-commits
Cc: Hailong Liu, Peter Zijlstra (Intel), Suren Baghdasaryan, x86,
linux-kernel
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 915a087e4c47334a2f7ba2a4092c4bade0873769
Gitweb: https://git.kernel.org/tip/915a087e4c47334a2f7ba2a4092c4bade0873769
Author: Hailong Liu <liuhailong@linux.alibaba.com>
AuthorDate: Fri, 01 Apr 2022 13:10:11 +08:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Fri, 22 Apr 2022 12:14:06 +02:00
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
---
kernel/sched/psi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
index a4fa3aa..5a49a8c 100644
--- a/kernel/sched/psi.c
+++ b/kernel/sched/psi.c
@@ -1117,7 +1117,8 @@ struct psi_trigger *psi_trigger_create(struct psi_group *group,
t->state = state;
t->threshold = threshold_us * NSEC_PER_USEC;
t->win.size = window_us * NSEC_PER_USEC;
- window_reset(&t->win, 0, 0, 0);
+ window_reset(&t->win, sched_clock(),
+ group->total[PSI_POLL][t->state], 0);
t->event = 0;
t->last_event_time = 0;
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-04-22 10:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-01 5:10 [PATCH] psi: Fix trigger being fired unexpectedly at initial Hailong Liu
2022-04-01 16:19 ` Suren Baghdasaryan
2022-04-06 11:11 ` Peter Zijlstra
2022-04-22 10:27 ` [tip: sched/core] " tip-bot2 for Hailong Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox