From: Chuck Lever <chuck.lever@oracle.com>
To: anna.schumaker@netapp.com
Cc: linux-rdma@vger.kernel.org, linux-nfs@vger.kernel.org
Subject: [PATCH 6/6] SUNRPC: Micro-optimize __rpc_execute
Date: Wed, 03 Jan 2018 15:38:49 -0500 [thread overview]
Message-ID: <20180103203849.29209.23116.stgit@manet.1015granger.net> (raw)
In-Reply-To: <20180103203540.29209.4620.stgit@manet.1015granger.net>
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>
---
net/sunrpc/sched.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index c292a5e..896691a 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -755,21 +755,19 @@ static void __rpc_execute(struct rpc_task *task)
void (*do_action)(struct rpc_task *);
/*
- * Execute any pending callback first.
+ * Perform the next FSM step or a pending callback.
+ *
+ * tk_action may be NULL if the task has been killed.
+ * In particular, note that rpc_killall_tasks may
+ * do this at any time, so beware when dereferencing.
*/
- do_action = task->tk_callback;
- task->tk_callback = NULL;
- if (do_action == NULL) {
- /*
- * Perform the next FSM step.
- * tk_action may be NULL if the task has been killed.
- * In particular, note that rpc_killall_tasks may
- * do this at any time, so beware when dereferencing.
- */
- do_action = task->tk_action;
- if (do_action == NULL)
- break;
+ do_action = task->tk_action;
+ if (task->tk_callback) {
+ do_action = task->tk_callback;
+ task->tk_callback = NULL;
}
+ if (!do_action)
+ break;
trace_rpc_task_run_action(task->tk_client, task, do_action);
do_action(task);
prev parent reply other threads:[~2018-01-03 20:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-03 20:38 [PATCH 0/6] Final NFS/RDMA series for v4.16 Chuck Lever
2018-01-03 20:38 ` [PATCH 1/6] xprtrdma: Fix "bytes registered" accounting Chuck Lever
2018-01-03 20:38 ` [PATCH 2/6] xprtrdma: Correct some documenting comments Chuck Lever
2018-01-03 20:38 ` [PATCH 3/6] SUNRPC: Trace xprt_timer events Chuck Lever
2018-01-03 20:38 ` [PATCH 4/6] sunrpc: Format RPC events consistently for display Chuck Lever
2018-01-03 20:38 ` [PATCH 5/6] SUNRPC: task_run_action should display tk_callback Chuck Lever
2018-01-03 20:38 ` Chuck Lever [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180103203849.29209.23116.stgit@manet.1015granger.net \
--to=chuck.lever@oracle.com \
--cc=anna.schumaker@netapp.com \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).