Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1426971

[PATCH 1/6] clocksource: Make clocksource insert entry more efficient

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From John Stultz <john.stultz@linaro.org>
Newsgroups linux.kernel
Subject [PATCH 1/6] clocksource: Make clocksource insert entry more efficient
Date Mon, 20 Jun 2016 22:00:01 +0200
Message-ID <rMdwt-44L-9@gated-at.bofh.it> (permalink)
References <rMdwt-44L-11@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lV6q5vPUy4P+697c/uEzhmntEuLj9P4H6403/FNVzA4=; b=EyjyiXT40eRhtbzVzFB4N02trg+mKjGx249yxgm9Lg7olIYhYVsPotk6+uY2UcGUGr pm7tu1ZQES//xCAdOSSurKCt/dXs3sApXYRUgkgQGTe+ABnyquvL+ublZ5aJ0DVsRC/B FhnziB+62GtVcmWOhknIwZH3ERXDFCLmHK/Vs=
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lV6q5vPUy4P+697c/uEzhmntEuLj9P4H6403/FNVzA4=; b=KiQHDlMaCMw+DbBNyPX/ESyT6wEhALaK6zgRa1uX8QTOwMmCj44EkFBV+O9VW5HqGd PiHEeUFz1J4cMI+tq4GKXc2YHcmj1gymVsbJQ2cZbhEtmX+4Qc60Hgo6Hh2frG/a5sdp HY271cLZxtNw+I1bquDVnWlQNPmqMaddkN2WOv/Wv4NQAuZ4NsJAOwYbW6EijDBSOvFW dK/IA/9K84zIklPIFgCVkK8mBFQeCmgHOVkAHfDZpLGFB6pa0jAlW6Ue/KdWXYmujd79 YQRKStuJBe1ESrGA2WVh2V/+zR0JwbfjGS1IMoOhYiGBqMYDwYQgQzobB3jzN0uzRYBO jttg==
X-Gm-Message-State ALyK8tJotUIbXtWvJ/HfIvijXEc9C9TnSdEYXuhzyKP1HokVSV2na8t6qkK0Gb/i9jGJNFXO
X-Received by 10.66.86.103 with SMTP id o7mr1810946paz.5.1466452596937; Mon, 20 Jun 2016 12:56:36 -0700 (PDT)
X-Mailer git-send-email 1.9.1
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 39
Organization linux.* mail to news gateway
X-Original-Cc Minfei Huang <mnghuan@gmail.com>, Prarit Bhargava <prarit@redhat.com>, Richard Cochran <richardcochran@gmail.com>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@kernel.org>, John Stultz <john.stultz@linaro.org>
X-Original-Date Mon, 20 Jun 2016 12:56:20 -0700
X-Original-Message-ID <1466452585-29379-2-git-send-email-john.stultz@linaro.org>
X-Original-References <1466452585-29379-1-git-send-email-john.stultz@linaro.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1426971

Show key headers only | View raw


From: Minfei Huang <mnghuan@gmail.com>

In clocksource_enqueue(), it is unnecessary to continue looping
the list, if we find there is an entry that the value of rating
is smaller than the new one. It is safe to be out the loop,
because all of entry are inserted in descending order.

Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Minfei Huang <mnghuan@gmail.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 kernel/time/clocksource.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 56ece14..6a5a310 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -669,10 +669,12 @@ static void clocksource_enqueue(struct clocksource *cs)
 	struct list_head *entry = &clocksource_list;
 	struct clocksource *tmp;
 
-	list_for_each_entry(tmp, &clocksource_list, list)
+	list_for_each_entry(tmp, &clocksource_list, list) {
 		/* Keep track of the place, where to insert */
-		if (tmp->rating >= cs->rating)
-			entry = &tmp->list;
+		if (tmp->rating < cs->rating)
+			break;
+		entry = &tmp->list;
+	}
 	list_add(&cs->list, entry);
 }
 
-- 
1.9.1

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 1/6] clocksource: Make clocksource insert entry more efficient John Stultz <john.stultz@linaro.org> - 2016-06-20 22:00 +0200

csiph-web