Skip to content

Commit f8335a2

Browse files
committed
SUNRPC: Move initialization of rq_stime
Micro-optimization: Call ktime_get() only when ->xpo_recvfrom() has given us a full RPC message to process. rq_stime isn't used otherwise, so this avoids pointless work. Reviewed-by: Jeff Layton <[email protected]> Acked-by: Tom Talpey <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent 5581cf8 commit f8335a2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/sunrpc/svc_xprt.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,6 @@ static int svc_handle_xprt(struct svc_rqst *rqstp, struct svc_xprt *xprt)
849849
len = svc_deferred_recv(rqstp);
850850
else
851851
len = xprt->xpt_ops->xpo_recvfrom(rqstp);
852-
rqstp->rq_stime = ktime_get();
853852
rqstp->rq_reserved = serv->sv_max_mesg;
854853
atomic_add(rqstp->rq_reserved, &xprt->xpt_reserved);
855854
} else
@@ -892,6 +891,7 @@ int svc_recv(struct svc_rqst *rqstp, long timeout)
892891
err = -EAGAIN;
893892
if (len <= 0)
894893
goto out_release;
894+
895895
trace_svc_xdr_recvfrom(&rqstp->rq_arg);
896896

897897
clear_bit(XPT_OLD, &xprt->xpt_flags);
@@ -900,6 +900,7 @@ int svc_recv(struct svc_rqst *rqstp, long timeout)
900900

901901
if (serv->sv_stats)
902902
serv->sv_stats->netcnt++;
903+
rqstp->rq_stime = ktime_get();
903904
return len;
904905
out_release:
905906
rqstp->rq_res.len = 0;

0 commit comments

Comments
 (0)