lkml.org 
[lkml]   [2018]   [Nov]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] timers: Make the lower-level timer function first call than higher-level
Date
The elements of the heads array are a linked list of timer events that
expire at the current time. And it can contain up to LVL_DEPTH levels
and the lower the level represents the smaller the time granularity.

Now the result is that the function, which will be called when the timer
expires, in the higher-level is called first than the lower-level function.
I think it might be better to call the lower-level timer function first
than the higher-level function. Because the lower-level has the smaller
granularity and delay has less impact on higher-level. So fix it.

Signed-off-by: Muchun Song <smuchun@gmail.com>
---
kernel/time/timer.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index fa49cd753dea..7c757b27aa58 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1674,12 +1674,13 @@ static inline void __run_timers(struct timer_base *base)
base->must_forward_clk = false;

while (time_after_eq(jiffies, base->clk)) {
+ int i;

levels = collect_expired_timers(base, heads);
base->clk++;

- while (levels--)
- expire_timers(base, heads + levels);
+ for (i = 0; i < levels; i++)
+ expire_timers(base, heads + i);
}
base->running_timer = NULL;
raw_spin_unlock_irq(&base->lock);
--
2.17.1
\
 
 \ /
  Last update: 2018-11-19 15:11    [W:0.075 / U:9.664 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site