All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Time: Clocksource: finish searching when clocksource_enqueue() found the inserting place.
@ 2013-09-16 18:08 ERAMOTO Masaya
  0 siblings, 0 replies; only message in thread
From: ERAMOTO Masaya @ 2013-09-16 18:08 UTC (permalink / raw)
  To: John Stultz, Thomas Gleixner, linux-kernel

Hi,

clocksource_enqueue() do extra behavior in the sorted list as below:
   * it compares all clocksources in the list even if found the
     inserting place.
   * it copies to entry until finding there.

So fixed clocksource_enqueue() as below:
   * it finishes to compare clocksource when found there.
   * it copies to entry only when found there.

Signed-off-by: ERAMOTO Masaya <eramoto.masaya@gmail.com>
---
  kernel/time/clocksource.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 50a8736..5b340a4 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -700,9 +700,11 @@ 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;
-	list_add(&cs->list, entry);
+			break;
+		}
+	list_add_tail(&cs->list, entry);
  }

  /**

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-09-16 18:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-16 18:08 [PATCH] Time: Clocksource: finish searching when clocksource_enqueue() found the inserting place ERAMOTO Masaya

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.