mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] sched/psi: avoid resetting the min update period when it is unnecessary
@ 2023-05-14 16:33 Suren Baghdasaryan
  2023-05-15  8:27 ` Peter Zijlstra
  2023-05-22  7:36 ` [tip: sched/core] sched/psi: Avoid " tip-bot2 for Yang Yang
  0 siblings, 2 replies; 3+ messages in thread
From: Suren Baghdasaryan @ 2023-05-14 16:33 UTC (permalink / raw)
  To: peterz
  Cc: yang.yang29, mingo, axboe, tj, hannes, juri.lelli, linux-kernel, surenb

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>
---
rebase of https://lore.kernel.org/all/202305121642367753446@zte.com.cn/
over git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core branch

 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 b49af594ad28..81fca77397f6 100644
--- a/kernel/sched/psi.c
+++ b/kernel/sched/psi.c
@@ -1407,11 +1407,16 @@ void psi_trigger_destroy(struct psi_trigger *t)
 			group->rtpoll_nr_triggers[t->state]--;
 			if (!group->rtpoll_nr_triggers[t->state])
 				group->rtpoll_states &= ~(1 << t->state);
-			/* reset min update period for the remaining triggers */
-			list_for_each_entry(tmp, &group->rtpoll_triggers, node)
-				period = min(period, div_u64(tmp->win.size,
-						UPDATES_PER_WINDOW));
-			group->rtpoll_min_period = period;
+			/*
+			 * Reset min update period for the remaining triggers
+			 * iff the destroying trigger had the min window size.
+			 */
+			if (group->rtpoll_min_period == div_u64(t->win.size, UPDATES_PER_WINDOW)) {
+				list_for_each_entry(tmp, &group->rtpoll_triggers, node)
+					period = min(period, div_u64(tmp->win.size,
+							UPDATES_PER_WINDOW));
+				group->rtpoll_min_period = period;
+			}
 			/* Destroy rtpoll_task when the last trigger is destroyed */
 			if (group->rtpoll_states == 0) {
 				group->rtpoll_until = 0;
-- 
2.40.1.606.ga4b1b128d6-goog


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

* Re: [PATCH 1/1] sched/psi: avoid resetting the min update period when it is unnecessary
  2023-05-14 16:33 [PATCH 1/1] sched/psi: avoid resetting the min update period when it is unnecessary Suren Baghdasaryan
@ 2023-05-15  8:27 ` Peter Zijlstra
  2023-05-22  7:36 ` [tip: sched/core] sched/psi: Avoid " tip-bot2 for Yang Yang
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2023-05-15  8:27 UTC (permalink / raw)
  To: Suren Baghdasaryan
  Cc: yang.yang29, mingo, axboe, tj, hannes, juri.lelli, linux-kernel

On Sun, May 14, 2023 at 09:33:38AM -0700, Suren Baghdasaryan 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>
> ---
> rebase of https://lore.kernel.org/all/202305121642367753446@zte.com.cn/
> over git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core branch

Thanks!

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

* [tip: sched/core] sched/psi: Avoid resetting the min update period when it is unnecessary
  2023-05-14 16:33 [PATCH 1/1] sched/psi: avoid resetting the min update period when it is unnecessary Suren Baghdasaryan
  2023-05-15  8:27 ` Peter Zijlstra
@ 2023-05-22  7:36 ` tip-bot2 for Yang Yang
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Yang Yang @ 2023-05-22  7:36 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Yang Yang, Peter Zijlstra (Intel), Suren Baghdasaryan, x86, linux-kernel

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     e2a1f85bf9f509afd09b5d3308e3489b65845c28
Gitweb:        https://git.kernel.org/tip/e2a1f85bf9f509afd09b5d3308e3489b65845c28
Author:        Yang Yang <yang.yang29@zte.com.cn>
AuthorDate:    Sun, 14 May 2023 09:33:38 -07:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Sat, 20 May 2023 12:53:16 +02:00

sched/psi: Avoid resetting the min update period when it is unnecessary

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>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Suren Baghdasaryan <surenb@google.com>
Link: https://lkml.kernel.org/r/20230514163338.834345-1-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 b49af59..81fca77 100644
--- a/kernel/sched/psi.c
+++ b/kernel/sched/psi.c
@@ -1407,11 +1407,16 @@ void psi_trigger_destroy(struct psi_trigger *t)
 			group->rtpoll_nr_triggers[t->state]--;
 			if (!group->rtpoll_nr_triggers[t->state])
 				group->rtpoll_states &= ~(1 << t->state);
-			/* reset min update period for the remaining triggers */
-			list_for_each_entry(tmp, &group->rtpoll_triggers, node)
-				period = min(period, div_u64(tmp->win.size,
-						UPDATES_PER_WINDOW));
-			group->rtpoll_min_period = period;
+			/*
+			 * Reset min update period for the remaining triggers
+			 * iff the destroying trigger had the min window size.
+			 */
+			if (group->rtpoll_min_period == div_u64(t->win.size, UPDATES_PER_WINDOW)) {
+				list_for_each_entry(tmp, &group->rtpoll_triggers, node)
+					period = min(period, div_u64(tmp->win.size,
+							UPDATES_PER_WINDOW));
+				group->rtpoll_min_period = period;
+			}
 			/* Destroy rtpoll_task when the last trigger is destroyed */
 			if (group->rtpoll_states == 0) {
 				group->rtpoll_until = 0;

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-14 16:33 [PATCH 1/1] sched/psi: avoid resetting the min update period when it is unnecessary Suren Baghdasaryan
2023-05-15  8:27 ` Peter Zijlstra
2023-05-22  7:36 ` [tip: sched/core] sched/psi: Avoid " tip-bot2 for Yang Yang

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

all inboxes | Powered by JetHome®