linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] timers: Make the lower-level timer function first call than higher-level
@ 2018-11-19 14:10 Muchun Song
  2018-11-19 18:16 ` John Stultz
  0 siblings, 1 reply; 6+ messages in thread
From: Muchun Song @ 2018-11-19 14:10 UTC (permalink / raw)
  To: john.stultz, tglx, sboyd; +Cc: linux-kernel

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-11-28 16:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-19 14:10 [PATCH] timers: Make the lower-level timer function first call than higher-level Muchun Song
2018-11-19 18:16 ` John Stultz
2018-11-20  2:08   ` Muchun Song
2018-11-21 20:44     ` Thomas Gleixner
2018-11-28 15:15       ` Thomas Gleixner
2018-11-28 16:51         ` Muchun Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).