sched/psi: avoid unnecessary resetting min update period when destroy trigger
Subsystems (2)
PATCH 1/1 sched/psi: avoid unnecessary resetting min update period when destroy trigger
From: Yang Yang <[email protected]>
Psi_group's poll_min_period is determined by the min window size of psi_trigger when creating new triggers. While destroying a psi_trigger, there is no need to reset poll_min_period if the destroying psi_trigger not had the min windows size, since in this condition poll_min_period will keep the same as before.
--- kernel/sched/psi.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
kernel/sched/psi.c +10 -5
@@ -1359,11 +1359,16 @@ void psi_trigger_destroy(struct psi_trigger *t) group->nr_triggers[t->state]--;if (!group->nr_triggers[t->state]) group->poll_states &= ~(1 << t->state); -/* reset min update period for the remaining triggers */ -list_for_each_entry (tmp, &group->triggers, node) - period =min (period,div_u64 (tmp->win.size, -UPDATES_PER_WINDOW )); - group->poll_min_period = period; +/* +* Reset min update period for the remaining triggers iff the destroying +* trigger had the min window size. +*/ +if (group->poll_min_period ==div_u64 (t->win.size,UPDATES_PER_WINDOW )) { +list_for_each_entry (tmp, &group->triggers, node) + period =min (period,div_u64 (tmp->win.size, +UPDATES_PER_WINDOW )); + group->poll_min_period = period; + }/* Destroy poll_task when the last trigger is destroyed */ if (group->poll_states ==0 ) { group->polling_until =0 ;
Signature · 1 line
2.25.1
Quoted 8 lines · On Mon, Apr 17, 2023 at 1:12 AM <[email protected]> wrote:
From: Yang Yang <[email protected]>
Psi_group's
poll_min_periodis determined by the min window size ofpsi_triggerwhen creating new triggers. While destroying apsi_trigger, there is no need to resetpoll_min_periodif the destroyingpsi_triggernot had the min windows size, since in this conditionpoll_min_periodwill keep the same as before.
Nice optimization.
Quoted 2 lines
Signed-off-by Yang Yang <[email protected]>
Quoted 32 lines
--- kernel/sched/psi.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)kernel/sched/psi.c +10
-6@@ -1359,11 +1359,16 @@ void psi_trigger_destroy(struct psi_trigger *t) group->nr_triggers[t->state]--;if (!group->nr_triggers[t->state]) group->poll_states &= ~(1 << t->state); -/* reset min update period for the remaining triggers */ -list_for_each_entry (tmp, &group->triggers, node) - period =min (period,div_u64 (tmp->win.size, -UPDATES_PER_WINDOW )); - group->poll_min_period = period; +/* +* Reset min update period for the remaining triggers iff the destroying +* trigger had the min window size. +*/ +if (group->poll_min_period ==div_u64 (t->win.size,UPDATES_PER_WINDOW )) { +list_for_each_entry (tmp, &group->triggers, node) + period =min (period,div_u64 (tmp->win.size, +UPDATES_PER_WINDOW )); + group->poll_min_period = period; + }/* Destroy poll_task when the last trigger is destroyed */ if (group->poll_states ==0 ) { group->polling_until =0 ; --2.25.1
Quoted 10 lines · On Mon, Apr 17, 2023 at 1:12 AM <[email protected]> wrote:
Quoted 8 lines
From: Yang Yang <[email protected]>
Psi_group's
poll_min_periodis determined by the min window size ofpsi_triggerwhen creating new triggers. While destroying apsi_trigger, there is no need to resetpoll_min_periodif the destroyingpsi_triggernot had the min windows size, since in this conditionpoll_min_periodwill keep the same as before.
Quoted 4 lines
Nice optimization.
Quoted 1 line
Signed-off-by Yang Yang <[email protected]>
Hi, would you please take a review?
Thanks!
Quoted 10 lines · On Mon, Apr 17, 2023 at 1:12 AM <[email protected]> wrote:
Quoted 8 lines
From: Yang Yang <[email protected]>
Psi_group's
poll_min_periodis determined by the min window size ofpsi_triggerwhen creating new triggers. While destroying apsi_trigger, there is no need to resetpoll_min_periodif the destroyingpsi_triggernot had the min windows size, since in this conditionpoll_min_periodwill keep the same as before.
Quoted 4 lines
Nice optimization.
Quoted 1 line
Signed-off-by Yang Yang <[email protected]>
Hi, would you please take a review?
Thanks!
Quoted 10 lines · On Mon, Apr 17, 2023 at 1:12 AM <[email protected]> wrote:
Quoted 8 lines
From: Yang Yang <[email protected]>
Psi_group's
poll_min_periodis determined by the min window size ofpsi_triggerwhen creating new triggers. While destroying apsi_trigger, there is no need to resetpoll_min_periodif the destroyingpsi_triggernot had the min windows size, since in this conditionpoll_min_periodwill keep the same as before.
Quoted 6 lines
Nice optimization.
Quoted 2 lines
Signed-off-by Yang Yang <[email protected]>
Hi, would you please take a review?
Thanks!
Suren Baghdasaryan
maintainerQuoted 11 lines · Yang Yang
Quoted 11 lines · On Mon, Apr 17, 2023 at 1:12 AM <[email protected]> wrote:
Quoted 8 lines
From: Yang Yang <[email protected]>
Psi_group's
poll_min_periodis determined by the min window size ofpsi_triggerwhen creating new triggers. While destroying apsi_trigger, there is no need to resetpoll_min_periodif the destroyingpsi_triggernot had the min windows size, since in this conditionpoll_min_periodwill keep the same as before.
Quoted 8 lines
Quoted 6 lines
Nice optimization.
Quoted 2 lines
Signed-off-by Yang Yang <[email protected]>Hi, would you please take a review?
I guess this is a ping for PeterZ to queue this patch in his tree. Peter, any issues with accepting this patch?
Quoted 1 line
Thanks!