diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2018-01-03 15:38:49 -0500 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2018-01-23 09:44:40 -0500 |
commit | 21ead9ff3dc72604d89499a1da5a18cc193ec4ff (patch) | |
tree | e378fd0d6e8e3d21f8fc4334a64cea423f3f2698 | |
parent | cf08d6f2e6e1b9f177cafbe57e7ad33a76d32c38 (diff) |
SUNRPC: Micro-optimize __rpc_execute
The common case: There are 13 to 14 actions per RPC, and tk_callback
is non-NULL in only one of them. There's no need to store a NULL in
the tk_callback field during each FSM step.
This slightly improves throughput results in dbench and other multi-
threaded benchmarks on my two-socket client on 56Gb InfiniBand, but
will probably be inconsequential on slower systems.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
-rw-r--r-- | net/sunrpc/sched.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index c292a5e1a70c..896691afbb1a 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c | |||
@@ -755,21 +755,19 @@ static void __rpc_execute(struct rpc_task *task) | |||
755 | void (*do_action)(struct rpc_task *); | 755 | void (*do_action)(struct rpc_task *); |
756 | 756 | ||
757 | /* | 757 | /* |
758 | * Execute any pending callback first. | 758 | * Perform the next FSM step or a pending callback. |
759 | * | ||
760 | * tk_action may be NULL if the task has been killed. | ||
761 | * In particular, note that rpc_killall_tasks may | ||
762 | * do this at any time, so beware when dereferencing. | ||
759 | */ | 763 | */ |
760 | do_action = task->tk_callback; | 764 | do_action = task->tk_action; |
761 | task->tk_callback = NULL; | 765 | if (task->tk_callback) { |
762 | if (do_action == NULL) { | 766 | do_action = task->tk_callback; |
763 | /* | 767 | task->tk_callback = NULL; |
764 | * Perform the next FSM step. | ||
765 | * tk_action may be NULL if the task has been killed. | ||
766 | * In particular, note that rpc_killall_tasks may | ||
767 | * do this at any time, so beware when dereferencing. | ||
768 | */ | ||
769 | do_action = task->tk_action; | ||
770 | if (do_action == NULL) | ||
771 | break; | ||
772 | } | 768 | } |
769 | if (!do_action) | ||
770 | break; | ||
773 | trace_rpc_task_run_action(task->tk_client, task, do_action); | 771 | trace_rpc_task_run_action(task->tk_client, task, do_action); |
774 | do_action(task); | 772 | do_action(task); |
775 | 773 | ||