• Anna-Maria Behnsen's avatar
    timers: Implement the hierarchical pull model · 7ee98877
    Anna-Maria Behnsen authored
    Placing timers at enqueue time on a target CPU based on dubious heuristics
    does not make any sense:
    
     1) Most timer wheel timers are canceled or rearmed before they expire.
    
     2) The heuristics to predict which CPU will be busy when the timer expires
        are wrong by definition.
    
    So placing the timers at enqueue wastes precious cycles.
    
    The proper solution to this problem is to always queue the timers on the
    local CPU and allow the non pinned timers to be pulled onto a busy CPU at
    expiry time.
    
    Therefore split the timer storage into local pinned and global timers:
    Local pinned timers are always expired on the CPU on which they have been
    queued. Global timers can be expired on any CPU.
    
    As long as a CPU is busy it expires both local and global timers. When a
    CPU goes idle it arms for the first expiring local timer. If the first
    expiring pinned (local) timer is before the first expiring movable timer,
    then no action is required because the CPU will wake up before...
    7ee98877
timer_migration.h 4.99 KB