• Andrew Morton's avatar
    [PATCH] timer race fixes · c49d8060
    Andrew Morton authored
    From: Ingo Molnar <mingo@elte.hu>
    
    It unifies the functionality of add_timer() and mod_timer(), and makes any
    combination of the timer API calls completely SMP-safe.  del_timer() is still
    not using the timer lock.
    
    this patch fixes the only timer bug in 2.6 i'm aware of: the del_timer_sync()
    + add_timer() combination in kernel/itimer.c is buggy.  This was correct code
    in 2.4, because there it was safe to do an add_timer() from the timer handler
    itself, parallel to a del_timer_sync().
    
    If we want to make this safe in 2.6 too (which i think we want to) then we
    have to make add_timer() almost equivalent to mod_timer(), locking-wise.  And
    once we are at this point i think it's much cleaner to actually make
    add_timer() a variant of mod_timer().  (There's no locking cost for
    add_timer(), only the cost of an extra branch.  And we've removed another
    commonly used function from the icache.)
    c49d8060
timer.c 33 KB