1. First step for dynticks
in FreeBSD
Tsuyoshi Ozawa
Univ. of Tsukuba
ozawa@softlab.cs.tsukuba.ac.jp
ozawa@t-oza.net
AsiaBSDcon March 14th, 2010 Work-In-Progress talk
2. Ticks
HZ HZ time
• Timer interrupt is important processing to
work kernel correctly
• But it is very expensive to handle periodic
ticks
3. Ticks
HZ HZ time
• Timer interrupt is important processing to
work kernel correctly
• But it is very expensive to handle periodic
ticks
4. Ticks
HZ HZ time
• Timer interrupt is important processing to
work kernel correctly
• But it is very expensive to handle periodic
ticks
5. Ticks
HZ HZ time
• Timer interrupt is important processing to
work kernel correctly
• But it is very expensive to handle periodic
ticks
6. Dynticks
time
when next Timer is going to be fired
• Timer interrupts are generated by using oneshot timer.
• This feature is implemented in Solaris, Linux and etc.
7. Dynticks
time
when next Timer is going to be fired
• Timer interrupts are generated by using oneshot timer.
• This feature is implemented in Solaris, Linux and etc.
8. Dynticks
time
when next Timer is going to be fired
• Timer interrupts are generated by using oneshot timer.
• This feature is implemented in Solaris, Linux and etc.
9. Dynticks
time
when next Timer is going to be fired
• Timer interrupts are generated by using oneshot timer.
• This feature is implemented in Solaris, Linux and etc.
10. Benefits
• If OSes can skip needless ticks...
• Save power consumption
• OS in Virtual Machine work more lightly (e.g.
FreeBSD as guest OS)
VMware, “Timekeeping in VMware Virtual Machines”, http://
www.vmware.com/pdf/vmware_timekeeping.pdf, 2008
12. Rough Design
• Switch mode between periodic tick mode
& dynamic tick mode
• The switch trigger is when to be scheduled
sched_idletd
• This function only works when CPU is idle
• If the cpu is idle, the CPU has no need to know
what current time is.
• Scan callout queue & get next event
13. 2 tick mode transition
after sched_idletd is scheduled
time
HZ HZ HZ when next Timer is going to be fired
Periodic tick mode Dynamic tick mode
• The idle process( sched_idletd ) trigger the
mode transition
14. 2 tick mode transition
after sched_idletd is scheduled
time
HZ HZ HZ when next Timer is going to be fired
Periodic tick mode Dynamic tick mode
• The idle process( sched_idletd ) trigger the
mode transition
15. 2 tick mode transition
after sched_idletd is scheduled
time
HZ HZ HZ when next Timer is going to be fired
Periodic tick mode Dynamic tick mode
• The idle process( sched_idletd ) trigger the
mode transition
16. 2 tick mode transition
after sched_idletd is scheduled
time
HZ HZ HZ when next Timer is going to be fired
Periodic tick mode Dynamic tick mode
• The idle process( sched_idletd ) trigger the
mode transition
17. 2 tick mode transition
after sched_idletd is scheduled
time
HZ HZ HZ when next Timer is going to be fired
Periodic tick mode Dynamic tick mode
• The idle process( sched_idletd ) trigger the
mode transition
18. 2 tick mode transition
after sched_idletd is scheduled
time
HZ HZ HZ when next Timer is going to be fired
Periodic tick mode Dynamic tick mode
• The idle process( sched_idletd ) trigger the
mode transition
19. Current status
• Started to write code 11th March,
2010(JST)
• I implemented to scan callout queue
The routine scan when the next timer
event come up?