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>] [day] [month] [year] [list]
Date:   Tue, 26 Mar 2019 19:34:19 +0800
From:   Yongkai Wu <nic.wuyk@...il.com>
To:     John Stultz <john.stultz@...aro.org>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Stephen Boyd <sboyd@...nel.org>, linux-kernel@...r.kernel.org,
        nic_w@....com
Subject: [PATCH] clocksource: Make clocksource insert entry more efficient

In clocksource_enqueue(), it is unnecessary to do
entry = &tmp->list
in every loop,do it once in the last loop is enough.

Signed-off-by: Yongkai Wu <nic_w@....com>
---
 kernel/time/clocksource.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 3bcc19c..da4829b 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -829,11 +829,12 @@ static void clocksource_enqueue(struct clocksource *cs)
 
 	list_for_each_entry(tmp, &clocksource_list, list) {
 		/* Keep track of the place, where to insert */
-		if (tmp->rating < cs->rating)
+		if (tmp->rating < cs->rating) {
+			entry = &tmp->list;
 			break;
-		entry = &tmp->list;
+		}
 	}
-	list_add(&cs->list, entry);
+	list_add_tail(&cs->list, entry);
 }
 
 /**
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ