From: "levi.yun" <ppbuk5246@gmail.com>
To: hannes@cmpxchg.org, surenb@google.com, peterz@infradead.org,
mingo@redhat.com, juri.lelli@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
bristot@redhat.com, vschneid@redhat.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] psi: Fix avg trigger being fired unexpectedly.
Date: Tue, 12 Mar 2024 06:10:38 +0000 [thread overview]
Message-ID: <Ze_x3kovSFe4z9SO@Levi-MacBook-Pro.local> (raw)
In-Reply-To: <20240226211237.48415-1-ppbuk5246@gmail.com>
Gentle ping..
On Mon, Feb 26, 2024 at 09:12:37PM +0000, Levi Yun wrote:
> commit 915a087e4c473("psi: Fix trigger being fired unexpectedly at initial")
> fixes unexpected event fired when group->total accumulated for PSI_POLL.
> But, for PSI_AVGS, win->value should be initialized with group->total[PSI_AVGS].
> Moreover, to get exact initial value for win->value, it should be set
> under each trigger lock to avoid concurrent changes to group->total[].
>
> Signed-off-by: Levi Yun <ppbuk5246@gmail.com>
> Acked-by: Suren Baghdasaryan <surenb@google.com>
> ---
> v2: Fix commit message.
> ---
> 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 7b4aa5809c0f..e7f66ab2ad3e 100644
> --- a/kernel/sched/psi.c
> +++ b/kernel/sched/psi.c
> @@ -1323,9 +1323,6 @@ struct psi_trigger *psi_trigger_create(struct psi_group *group, char *buf,
> t->state = state;
> t->threshold = threshold_us * NSEC_PER_USEC;
> t->win.size = window_us * NSEC_PER_USEC;
> - window_reset(&t->win, sched_clock(),
> - group->total[PSI_POLL][t->state], 0);
> -
> t->event = 0;
> t->last_event_time = 0;
> t->of = of;
> @@ -1336,6 +1333,8 @@ struct psi_trigger *psi_trigger_create(struct psi_group *group, char *buf,
>
> if (privileged) {
> mutex_lock(&group->rtpoll_trigger_lock);
> + window_reset(&t->win, sched_clock(),
> + group->total[PSI_POLL][t->state], 0);
>
> if (!rcu_access_pointer(group->rtpoll_task)) {
> struct task_struct *task;
> @@ -1361,6 +1360,9 @@ struct psi_trigger *psi_trigger_create(struct psi_group *group, char *buf,
> } else {
> mutex_lock(&group->avgs_lock);
>
> + window_reset(&t->win, sched_clock(),
> + group->total[PSI_AVGS][t->state], 0);
> +
> list_add(&t->node, &group->avg_triggers);
> group->avg_nr_triggers[t->state]++;
>
> --
> 2.39.2
next prev parent reply other threads:[~2024-03-12 6:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-26 21:12 [PATCH v2] psi: Fix avg trigger being fired unexpectedly Levi Yun
2024-03-12 6:10 ` levi.yun [this message]
2024-03-26 17:49 ` Suren Baghdasaryan
2024-03-26 18:01 ` Suren Baghdasaryan
2024-04-18 17:15 ` Suren Baghdasaryan
2024-05-04 12:34 ` Markus Elfring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Ze_x3kovSFe4z9SO@Levi-MacBook-Pro.local \
--to=ppbuk5246@gmail.com \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=hannes@cmpxchg.org \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=surenb@google.com \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.