From 259aae864ceeb2b34e7bafa1ce18d096a357fab2 Mon Sep 17 00:00:00 2001
From: Thomas Gleixner <tglx@linutronix.de>
Date: Sat, 19 Apr 2008 21:31:26 +0200
Subject: [PATCH] hrtimer: optimize the softirq time optimization

The previous optimization did not take the case into account where a
clock provides its own softirq_get_time() function.

Check for the availablitiy of the clock get time function first and
then check if we need to retrieve the time for both clocks via
hrtimer_softirq_gettime() to avoid a double evaluation of time in that
case as well.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/hrtimer.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 70d4adc74639..f78777abe769 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -1254,14 +1254,13 @@ void hrtimer_run_queues(void)
 		if (!base->first)
 			continue;
 
-		if (gettime) {
+		if (base->get_softirq_time)
+			base->softirq_time = base->get_softirq_time();
+		else if (gettime) {
 			hrtimer_get_softirq_time(cpu_base);
 			gettime = 0;
 		}
 
-		if (base->get_softirq_time)
-			base->softirq_time = base->get_softirq_time();
-
 		spin_lock(&cpu_base->lock);
 
 		while ((node = base->first)) {