From 1b9407d76c0cb2e46ae7abc53de35fa91626bd7d Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Fri, 14 May 2004 05:49:27 -0700 Subject: [PATCH] Add del_single_shot_timer() From: Geoff Gustafson , "Chen, Kenneth W" , Ingo Molnar , 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) --- include/linux/timer.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/linux/timer.h') 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); -- cgit v1.2.3