]> git.hungrycats.org Git - linux/commit
[PATCH] timer race fixes
authorAndrew Morton <akpm@osdl.org>
Thu, 14 Aug 2003 17:07:00 +0000 (10:07 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Thu, 14 Aug 2003 17:07:00 +0000 (10:07 -0700)
commitc49d806049638d278c3d0cdc8d30d770fca183ce
tree87770f90fc0cdcf227bf4f98448f017292fdfd01
parent752274c9ef15215e1c9e7855450203326fdc3644
[PATCH] timer race fixes

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.)
include/linux/timer.h
kernel/ksyms.c
kernel/timer.c