lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <202305121642367753446@zte.com.cn>
Date:   Fri, 12 May 2023 16:42:36 +0800 (CST)
From:   <yang.yang29@....com.cn>
To:     <mingo@...hat.com>, <peterz@...radead.org>, <axboe@...nel.dk>,
        <tj@...nel.org>
Cc:     <hannes@...xchg.org>, <linux-kernel@...r.kernel.org>,
        <juri.lelli@...hat.com>
Subject: [RESEND PATCH linux-next] sched/psi: avoid resetting the min update period when it is unnecessary

From: Yang Yang <yang.yang29@....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@....com.cn>
Acked-by: Suren Baghdasaryan <surenb@...gle.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ