diff options
| author | Andrew Morton <akpm@osdl.org> | 2004-05-14 05:49:27 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-05-14 05:49:27 -0700 |
| commit | 1b9407d76c0cb2e46ae7abc53de35fa91626bd7d (patch) | |
| tree | 14bf1173e51b21f6154c136b494b7815f0827c21 /include | |
| parent | 496dc9b420ac2db0e639aca9b668de2a695d3277 (diff) | |
[PATCH] Add del_single_shot_timer()
From: Geoff Gustafson <geoff@linux.jf.intel.com>,
"Chen, Kenneth W" <kenneth.w.chen@intel.com>,
Ingo Molnar <mingo@elte.hu>,
me.
The big-SMP guys are seeing high CPU load due to del_timer_sync()'s
inefficiencies. The callers are fs/aio.c and schedule_timeout().
We note that neither of these callers' timer handlers actually re-add the
timer - they are single-shot.
So we don't need all that complexity in del_timer_sync() - we can just run
del_timer() and if that worked we know the timer is dead.
Add del_single_shot_timer(), export it to modules and use it in AIO and
schedule_timeout().
(these numbers are for an earlier patch, but they'll be close)
Before: 32p 4p
Warm cache 29,000 505
Cold cache 37,800 1220
After: 32p 4p
Warm cache 95 88
Cold cache 1,800 140
[Measurements are CPU cycles spent in a call to del_timer_sync, the average
of 1000 calls. 32p is 16-node NUMA, 4p is SMP.]
(I cleaned up a few things and added some commentary)
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/timer.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/timer.h b/include/linux/timer.h index d3033578361b..8efb6bcdcd3a 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -87,9 +87,11 @@ static inline void add_timer(struct timer_list * timer) } #ifdef CONFIG_SMP - extern int del_timer_sync(struct timer_list * timer); + extern int del_timer_sync(struct timer_list *timer); + extern int del_singleshot_timer_sync(struct timer_list *timer); #else # define del_timer_sync(t) del_timer(t) +# define del_singleshot_timer_sync(t) del_timer(t) #endif extern void init_timers(void); |
