Skip to content

Commit 21ead9f

Browse files
chuckleveramschuma-ntap
authored andcommitted
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 <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent cf08d6f commit 21ead9f

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

net/sunrpc/sched.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -755,21 +755,19 @@ static void __rpc_execute(struct rpc_task *task)
755755
void (*do_action)(struct rpc_task *);
756756

757757
/*
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.
759763
*/
760-
do_action = task->tk_callback;
761-
task->tk_callback = NULL;
762-
if (do_action == NULL) {
763-
/*
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;
764+
do_action = task->tk_action;
765+
if (task->tk_callback) {
766+
do_action = task->tk_callback;
767+
task->tk_callback = NULL;
772768
}
769+
if (!do_action)
770+
break;
773771
trace_rpc_task_run_action(task->tk_client, task, do_action);
774772
do_action(task);
775773

0 commit comments

Comments
 (0)