[PATCH] Time: Clocksource: finish searching when clocksource_enqueue()found the inserting place.

From: ERAMOTO Masaya
Date: Mon Sep 16 2013 - 14:09:11 EST


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@xxxxxxxxx>
---
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);
}

/**
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/