Skip to contentSkip to conversation

timers: Use the macro LVL_OFFS() to calculate the offset of each level

PATCH New Dianlong Li 1 participant 1 message Aug 29, 2021 High-resolution timers, timer wheel, clockevents

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 timers: Use the macro LVL_OFFS() to calculate the offset of each level

offset records the offset of the first bucket of each level, this can be replaced by the macro LVL_OFFS()

---
 kernel/time/timer.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/time/timer.c +3 -3
index e3d2c23c413d..3ee5322157a1 100644
@@ -1522,12 +1522,12 @@ static int next_pending_bucket(struct timer_base *base, unsigned offset,
 static unsigned long __next_timer_interrupt(struct timer_base *base)
 {
 	unsigned long clk, next, adj;
-	unsigned lvl, offset = 0;
+	unsigned int lvl;
 
 	next = base->clk + NEXT_TIMER_MAX_DELTA;
 	clk = base->clk;
-	for (lvl = 0; lvl < LVL_DEPTH; lvl++, offset += LVL_SIZE) {
-		int pos = next_pending_bucket(base, offset, clk & LVL_MASK);
+	for (lvl = 0; lvl < LVL_DEPTH; lvl++) {
+		int pos = next_pending_bucket(base, LVL_OFFS(lvl), clk & LVL_MASK);
 		unsigned long lvl_clk = clk & LVL_CLK_MASK;
 
 		if (pos >= 0) {
Signature · 1 line
2.17.1