diff -u --recursive --new-file linux-2.6.0-test3-06-reval/include/linux/sunrpc/sched.h linux-2.6.0-test3-07-timer_reso/include/linux/sunrpc/sched.h --- linux-2.6.0-test3-06-reval/include/linux/sunrpc/sched.h 2003-01-12 13:40:13.000000000 -0800 +++ linux-2.6.0-test3-07-timer_reso/include/linux/sunrpc/sched.h 2003-08-14 15:31:10.000000000 -0700 @@ -98,6 +98,9 @@ typedef void (*rpc_action)(struct rpc_task *); +/* RPC timer resolution */ +#define RPC_TIMER_RESO (HZ/10) + /* * RPC task flags */ diff -u --recursive --new-file linux-2.6.0-test3-06-reval/net/sunrpc/sched.c linux-2.6.0-test3-07-timer_reso/net/sunrpc/sched.c --- linux-2.6.0-test3-06-reval/net/sunrpc/sched.c 2003-06-20 13:16:26.000000000 -0700 +++ linux-2.6.0-test3-07-timer_reso/net/sunrpc/sched.c 2003-08-14 16:03:51.000000000 -0700 @@ -95,9 +95,9 @@ static inline void __rpc_disable_timer(struct rpc_task *task) { - dprintk("RPC: %4d disabling timer\n", task->tk_pid); + if (del_timer(&task->tk_timer)) + dprintk("RPC: %4d disabling timer\n", task->tk_pid); task->tk_timeout_fn = NULL; - task->tk_timeout = 0; } /* @@ -124,10 +124,15 @@ /* * Set up a timer for the current task. + * + * In order to keep the number of RPC resends etc. down, we + * enforce a timer resolution of RPC_TIMER_RESO == 1/10sec */ static inline void __rpc_add_timer(struct rpc_task *task, rpc_action timer) { + unsigned long expires; + if (!task->tk_timeout) return; @@ -138,7 +143,12 @@ task->tk_timeout_fn = timer; else task->tk_timeout_fn = __rpc_default_timer; - mod_timer(&task->tk_timer, jiffies + task->tk_timeout); + + /* Align the timeout to the next unit of RPC_TIMER_RESO */ + expires = task->tk_timeout + RPC_TIMER_RESO - 1; + expires -= expires % RPC_TIMER_RESO; + + mod_timer(&task->tk_timer, jiffies + expires); } /*