aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2007-03-29 16:47:53 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-05-01 01:17:10 -0400
commit2bea90d43a050bbc4021d44e59beb34f384438db (patch)
tree2dd3f15bd9df537166a82777b0c95243b90b17e1 /include/linux
parent511d2e8855a065c8251d0c140ebc353854f1929e (diff)
SUNRPC: RPC buffer size estimates are too large
The RPC buffer size estimation logic in net/sunrpc/clnt.c always significantly overestimates the requirements for the buffer size. A little instrumentation demonstrated that in fact rpc_malloc was never allocating the buffer from the mempool, but almost always called kmalloc. To compute the size of the RPC buffer more precisely, split p_bufsiz into two fields; one for the argument size, and one for the result size. Then, compute the sum of the exact call and reply header sizes, and split the RPC buffer precisely between the two. That should keep almost all RPC buffers within the 2KiB buffer mempool limit. And, we can finally be rid of RPC_SLACK_SPACE! Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/sunrpc/clnt.h3
-rw-r--r--include/linux/sunrpc/xprt.h4
2 files changed, 5 insertions, 2 deletions
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index c7a78eef2b4f..32c48a0b0d71 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -84,7 +84,8 @@ struct rpc_procinfo {
84 u32 p_proc; /* RPC procedure number */ 84 u32 p_proc; /* RPC procedure number */
85 kxdrproc_t p_encode; /* XDR encode function */ 85 kxdrproc_t p_encode; /* XDR encode function */
86 kxdrproc_t p_decode; /* XDR decode function */ 86 kxdrproc_t p_decode; /* XDR decode function */
87 unsigned int p_bufsiz; /* req. buffer size */ 87 unsigned int p_arglen; /* argument hdr length (u32) */
88 unsigned int p_replen; /* reply hdr length (u32) */
88 unsigned int p_count; /* call count */ 89 unsigned int p_count; /* call count */
89 unsigned int p_timer; /* Which RTT timer to use */ 90 unsigned int p_timer; /* Which RTT timer to use */
90 u32 p_statidx; /* Which procedure to account */ 91 u32 p_statidx; /* Which procedure to account */
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index f780e72fc417..7aa29502b187 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -84,7 +84,9 @@ struct rpc_rqst {
84 struct list_head rq_list; 84 struct list_head rq_list;
85 85
86 __u32 * rq_buffer; /* XDR encode buffer */ 86 __u32 * rq_buffer; /* XDR encode buffer */
87 size_t rq_bufsize; 87 size_t rq_bufsize,
88 rq_callsize,
89 rq_rcvsize;
88 90
89 struct xdr_buf rq_private_buf; /* The receive buffer 91 struct xdr_buf rq_private_buf; /* The receive buffer
90 * used in the softirq. 92 * used in the softirq.