sched: Improve AVR optimization of reschedule_timer()
Tweak the AVR register pressure optimization in reschedule_timer() to optimize it further. This improves the performance of AVR timers when there are several pending timers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
0f87493487
commit
884cee27eb
18
src/sched.c
18
src/sched.c
|
@ -136,14 +136,18 @@ reschedule_timer(struct timer *t)
|
|||
|
||||
// Find new timer position and update list
|
||||
timer_list = pos;
|
||||
while (pos->next && sched_is_before(pos->next->waketime, minwaketime))
|
||||
struct timer *prev;
|
||||
for (;;) {
|
||||
prev = pos;
|
||||
if (CONFIG_MACH_AVR)
|
||||
// micro optimization for AVR - reduces register pressure
|
||||
asm("" : "+r"(prev) : : "memory");
|
||||
pos = pos->next;
|
||||
t->next = pos->next;
|
||||
pos->next = t;
|
||||
|
||||
if (CONFIG_MACH_AVR)
|
||||
// micro optimization for AVR - reduces register pressure
|
||||
barrier();
|
||||
if (!pos || !sched_is_before(pos->waketime, minwaketime))
|
||||
break;
|
||||
}
|
||||
t->next = pos;
|
||||
prev->next = t;
|
||||
return timer_list;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue