lkml.org 
[lkml]   [2014]   [Apr]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH V2 25/36] hrtimer: call hrtimer_get_softirq_time() only if cpu_base->active_bases is set
Date
We need to call hrtimer_get_softirq_time() only once for a cpu_base from
hrtimer_run_queues(). And it shouldn't be called if there are no timers queued
for that cpu_base.

Currently we are managing this with help of a variable: gettime. This part of
code can be simplified by using cpu_base->active_bases instead. With this we can
get rid of the 'if' block from the loop iterating over all clock bases.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
kernel/hrtimer.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index b3ab19a..2d9a7e2 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -1458,19 +1458,16 @@ void hrtimer_run_queues(void)
struct hrtimer_cpu_base *cpu_base = &__get_cpu_var(hrtimer_bases);
struct hrtimer_clock_base *base;
unsigned int active_bases;
- int index, gettime = 1;
+ int index;

if (hrtimer_hres_active())
return;

- for_each_active_base(index, base, cpu_base, active_bases) {
- if (gettime) {
- hrtimer_get_softirq_time(cpu_base);
- gettime = 0;
- }
+ if (cpu_base->active_bases)
+ hrtimer_get_softirq_time(cpu_base);

+ for_each_active_base(index, base, cpu_base, active_bases) {
raw_spin_lock(&cpu_base->lock);
-
while ((node = timerqueue_getnext(&base->active))) {
struct hrtimer *timer;

--
1.7.12.rc2.18.g61b472e


\
 
 \ /
  Last update: 2014-04-04 11:21    [W:0.737 / U:0.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site