diff options
author | Trond Myklebust <trond.myklebust@fys.uio.no> | 2005-01-04 21:42:03 +0100 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@fys.uio.no> | 2005-01-04 21:42:03 +0100 |
commit | 842134f1e3a19a98f1757e11f509f63fd5257714 (patch) | |
tree | 148e08b4c9f4e825ffdfe7ce905386fdb525da9c /net | |
parent | 89a45174b6b32596ea98fa3f89a243e2c1188a01 (diff) | |
download | history-842134f1e3a19a98f1757e11f509f63fd5257714.tar.gz |
RPC: Optimize away unnecessary del_timer_sync() operations, when we
know there are no pending timers.
Signed-off-by: Trond Myklebust <trond.myklebust@fys.uio.no>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/sched.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index b553bf661f4d66..90e5e7e2d01d7d 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c @@ -104,6 +104,9 @@ static void rpc_run_timer(struct rpc_task *task) dprintk("RPC: %4d running timer\n", task->tk_pid); callback(task); } + smp_mb__before_clear_bit(); + clear_bit(RPC_TASK_HAS_TIMER, &task->tk_runstate); + smp_mb__after_clear_bit(); } /* @@ -122,6 +125,7 @@ __rpc_add_timer(struct rpc_task *task, rpc_action timer) task->tk_timeout_fn = timer; else task->tk_timeout_fn = __rpc_default_timer; + set_bit(RPC_TASK_HAS_TIMER, &task->tk_runstate); mod_timer(&task->tk_timer, jiffies + task->tk_timeout); } @@ -132,8 +136,10 @@ __rpc_add_timer(struct rpc_task *task, rpc_action timer) static inline void rpc_delete_timer(struct rpc_task *task) { - if (del_timer_sync(&task->tk_timer)) + if (test_and_clear_bit(RPC_TASK_HAS_TIMER, &task->tk_runstate)) { + del_singleshot_timer_sync(&task->tk_timer); dprintk("RPC: %4d deleting timer\n", task->tk_pid); + } } /* |