psi: Fix avg trigger being fired unexpectedly.
Subsystems (3)
PATCH v2 1/1 psi: Fix avg trigger being fired unexpectedly.
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[].
---
v2: Fix commit message.
--- kernel/sched/psi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
kernel/sched/psi.c +5 -3
@@ -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
Gentle ping..
Quoted 49 lines · Levi Yun
commit 915a087e4c473("psi: Fix trigger being fired unexpectedly at initial") fixes unexpected event fired when
group->totalaccumulated forPSI_POLL. But, forPSI_AVGS,win->valueshould be initialized with group->total[PSI_AVGS]. Moreover, to get exact initial value forwin->value, it should be set under each trigger lock to avoid concurrent changes to group->total[].Signed-off-by Levi Yun <[email protected]>---
v2: Fix commit message.--- kernel/sched/psi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)kernel/sched/psi.c +5
-4@@ -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
Suren Baghdasaryan
maintainerQuoted 12 lines · levi.yun
Gentle ping..
Quoted 8 lines · Levi Yun
commit 915a087e4c473("psi: Fix trigger being fired unexpectedly at initial") fixes unexpected event fired when
group->totalaccumulated forPSI_POLL. But, forPSI_AVGS,win->valueshould be initialized with group->total[PSI_AVGS]. Moreover, to get exact initial value forwin->value, it should be set under each trigger lock to avoid concurrent changes to group->total[].Signed-off-by Levi Yun <[email protected]>
Hi Peter,
Could you please pull this patch into your tree? I don't see it in any tree, so I think you missed it.
Thanks,
Suren.
Quoted 41 lines
Quoted 41 lines
---
v2: Fix commit message.--- kernel/sched/psi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)kernel/sched/psi.c +5
-4@@ -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
Suren Baghdasaryan
maintainerQuoted 12 lines · Suren Baghdasaryan
Quoted 10 lines · levi.yun
Gentle ping..
Quoted 6 lines · Levi Yun
commit 915a087e4c473("psi: Fix trigger being fired unexpectedly at initial") fixes unexpected event fired when
group->totalaccumulated forPSI_POLL. But, forPSI_AVGS,win->valueshould be initialized with group->total[PSI_AVGS]. Moreover, to get exact initial value forwin->value, it should be set under each trigger lock to avoid concurrent changes to group->total[].
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Signed-off-by Levi Yun <[email protected]>Hi Peter,
Could you please pull this patch into your tree? I don't see it in any tree, so I think you missed it.
Forgot to set the right recipient. Fixed now.
Quoted 44 lines
Thanks,
Suren.Quoted 41 lines
Quoted 41 lines
---
v2: Fix commit message.--- kernel/sched/psi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)kernel/sched/psi.c +5
-4@@ -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
Suren Baghdasaryan
maintainerQuoted 12 lines · Suren Baghdasaryan
Quoted 10 lines · levi.yun
Gentle ping..
Quoted 6 lines · Levi Yun
commit 915a087e4c473("psi: Fix trigger being fired unexpectedly at initial") fixes unexpected event fired when
group->totalaccumulated forPSI_POLL. But, forPSI_AVGS,win->valueshould be initialized with group->total[PSI_AVGS]. Moreover, to get exact initial value forwin->value, it should be set under each trigger lock to avoid concurrent changes to group->total[].
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Signed-off-by Levi Yun <[email protected]>Hi Peter,
Could you please pull this patch into your tree? I don't see it in any tree, so I think you missed it.
I heard Peter is currently unavailable. Ingo, would you please take this patch into the scheduler tree?
Thanks,
Suren.
Quoted 44 lines
Thanks,
Suren.Quoted 41 lines
Quoted 41 lines
---
v2: Fix commit message.--- kernel/sched/psi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)kernel/sched/psi.c +5
-4@@ -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
…
Quoted 3 lines
But, for
PSI_AVGS,win->valueshould be initialized with group->total[PSI_AVGS]. Moreover, to get exact initial value forwin->value, it should be set under each trigger lock to avoid concurrent changes to group->total[].
…
Quoted 1 line
kernel/sched/psi.c | 8 +++++---
…
* Can imperative wordings be desirable for such a change description?
* Is there a need to perform proposed adjustments as separate update steps?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.9-rc6#n81
* Would you like to add the tag “Fixes” accordingly?
Regards,
Markus