clocksource: Make clocksource insert entry more efficient
PATCH 1/1 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 <[email protected]>
--- kernel/time/clocksource.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
kernel/time/clocksource.c +4 -3
@@ -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); }/**
Signature · 1 line
1.8.3.1