public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RESEND PATCH linux-next] sched/psi: avoid resetting the min update period when it is unnecessary
@ 2023-05-12  8:42 yang.yang29
  2023-05-12 17:56 ` Suren Baghdasaryan
  0 siblings, 1 reply; 4+ messages in thread
From: yang.yang29 @ 2023-05-12  8:42 UTC (permalink / raw)
  To: mingo, peterz, axboe, tj; +Cc: hannes, linux-kernel, juri.lelli

From: Yang Yang <yang.yang29@zte.com.cn>

Psi_group's poll_min_period is determined by the minimum 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 psi_trigger being destroyed did not
have the minimum window size, since in this condition poll_min_period will
remain the same as before.

Signed-off-by: Yang Yang <yang.yang29@zte.com.cn>
Acked-by: Suren Baghdasaryan <surenb@google.com>
---
 kernel/sched/psi.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
index 02e011cabe91..12869585cf89 100644
--- a/kernel/sched/psi.c
+++ b/kernel/sched/psi.c
@@ -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

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

* Re: [RESEND PATCH linux-next] sched/psi: avoid resetting the min update period when it is unnecessary
  2023-05-12  8:42 [RESEND PATCH linux-next] sched/psi: avoid resetting the min update period when it is unnecessary yang.yang29
@ 2023-05-12 17:56 ` Suren Baghdasaryan
  2023-05-13  9:45   ` Peter Zijlstra
  0 siblings, 1 reply; 4+ messages in thread
From: Suren Baghdasaryan @ 2023-05-12 17:56 UTC (permalink / raw)
  To: peterz, yang.yang29; +Cc: mingo, axboe, tj, hannes, linux-kernel, juri.lelli

On Fri, May 12, 2023 at 1:42 AM <yang.yang29@zte.com.cn> wrote:
>
> From: Yang Yang <yang.yang29@zte.com.cn>
>
> Psi_group's poll_min_period is determined by the minimum 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 psi_trigger being destroyed did not
> have the minimum window size, since in this condition poll_min_period will
> remain the same as before.
>
> Signed-off-by: Yang Yang <yang.yang29@zte.com.cn>
> Acked-by: Suren Baghdasaryan <surenb@google.com>

Hi Peter,
This is another psi-related patch that slipped through the cracks.
Could you please take it into your tree? The original one [1] had a
different title but the same code.
Thanks,
Suren.

[1] https://lore.kernel.org/all/202304171611545861530@zte.com.cn/


> ---
>  kernel/sched/psi.c | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
> index 02e011cabe91..12869585cf89 100644
> --- a/kernel/sched/psi.c
> +++ b/kernel/sched/psi.c
> @@ -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

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

* Re: [RESEND PATCH linux-next] sched/psi: avoid resetting the min update period when it is unnecessary
  2023-05-12 17:56 ` Suren Baghdasaryan
@ 2023-05-13  9:45   ` Peter Zijlstra
  2023-05-14 16:36     ` Suren Baghdasaryan
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Zijlstra @ 2023-05-13  9:45 UTC (permalink / raw)
  To: Suren Baghdasaryan
  Cc: yang.yang29, mingo, axboe, tj, hannes, linux-kernel, juri.lelli

On Fri, May 12, 2023 at 10:56:02AM -0700, Suren Baghdasaryan wrote:
> On Fri, May 12, 2023 at 1:42 AM <yang.yang29@zte.com.cn> wrote:
> >
> > From: Yang Yang <yang.yang29@zte.com.cn>
> >
> > Psi_group's poll_min_period is determined by the minimum 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 psi_trigger being destroyed did not
> > have the minimum window size, since in this condition poll_min_period will
> > remain the same as before.
> >
> > Signed-off-by: Yang Yang <yang.yang29@zte.com.cn>
> > Acked-by: Suren Baghdasaryan <surenb@google.com>
> 
> Hi Peter,
> This is another psi-related patch that slipped through the cracks.
> Could you please take it into your tree? The original one [1] had a
> different title but the same code.

It does not cleanly apply to tip/sched/core; could either of you rebase
please?

Thanks!

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

* Re: [RESEND PATCH linux-next] sched/psi: avoid resetting the min update period when it is unnecessary
  2023-05-13  9:45   ` Peter Zijlstra
@ 2023-05-14 16:36     ` Suren Baghdasaryan
  0 siblings, 0 replies; 4+ messages in thread
From: Suren Baghdasaryan @ 2023-05-14 16:36 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: yang.yang29, mingo, axboe, tj, hannes, linux-kernel, juri.lelli

On Sat, May 13, 2023 at 2:45 AM Peter Zijlstra <peterz@infradead.org> wrote:
>
> On Fri, May 12, 2023 at 10:56:02AM -0700, Suren Baghdasaryan wrote:
> > On Fri, May 12, 2023 at 1:42 AM <yang.yang29@zte.com.cn> wrote:
> > >
> > > From: Yang Yang <yang.yang29@zte.com.cn>
> > >
> > > Psi_group's poll_min_period is determined by the minimum 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 psi_trigger being destroyed did not
> > > have the minimum window size, since in this condition poll_min_period will
> > > remain the same as before.
> > >
> > > Signed-off-by: Yang Yang <yang.yang29@zte.com.cn>
> > > Acked-by: Suren Baghdasaryan <surenb@google.com>
> >
> > Hi Peter,
> > This is another psi-related patch that slipped through the cracks.
> > Could you please take it into your tree? The original one [1] had a
> > different title but the same code.
>
> It does not cleanly apply to tip/sched/core; could either of you rebase
> please?

Rebase is posted here:
https://lore.kernel.org/all/20230514163338.834345-1-surenb@google.com/
Thanks!

>
> Thanks!

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

end of thread, other threads:[~2023-05-14 16:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-12  8:42 [RESEND PATCH linux-next] sched/psi: avoid resetting the min update period when it is unnecessary yang.yang29
2023-05-12 17:56 ` Suren Baghdasaryan
2023-05-13  9:45   ` Peter Zijlstra
2023-05-14 16:36     ` Suren Baghdasaryan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox