Skip to content

Commit 6a0cdf5

Browse files
committed
SUNRPC: Be even lazier about releasing pages
A single RPC transaction that touches only a couple of pages means rq_pvec will not be even close to full in svc_xpt_release(). This is a common case. Instead, just leave the pages in rq_pvec until it is completely full. This improves the efficiency of the batch release mechanism on workloads that involve small RPC messages. The rq_pvec is also fully emptied just before thread exit. Reviewed-by: Calum Mackay <calum.mackay@oracle.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent 647a2a6 commit 6a0cdf5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

net/sunrpc/svc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,8 @@ svc_rqst_alloc(struct svc_serv *serv, struct svc_pool *pool, int node)
649649
if (!rqstp)
650650
return rqstp;
651651

652+
pagevec_init(&rqstp->rq_pvec);
653+
652654
__set_bit(RQ_BUSY, &rqstp->rq_flags);
653655
rqstp->rq_server = serv;
654656
rqstp->rq_pool = pool;
@@ -894,6 +896,7 @@ void svc_rqst_release_pages(struct svc_rqst *rqstp)
894896
void
895897
svc_rqst_free(struct svc_rqst *rqstp)
896898
{
899+
pagevec_release(&rqstp->rq_pvec);
897900
svc_release_buffer(rqstp);
898901
if (rqstp->rq_scratch_page)
899902
put_page(rqstp->rq_scratch_page);

net/sunrpc/svc_xprt.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,6 @@ static void svc_xprt_release(struct svc_rqst *rqstp)
541541
kfree(rqstp->rq_deferred);
542542
rqstp->rq_deferred = NULL;
543543

544-
pagevec_release(&rqstp->rq_pvec);
545544
svc_rqst_release_pages(rqstp);
546545
rqstp->rq_res.page_len = 0;
547546
rqstp->rq_res.page_base = 0;
@@ -667,8 +666,6 @@ static int svc_alloc_arg(struct svc_rqst *rqstp)
667666
struct xdr_buf *arg = &rqstp->rq_arg;
668667
unsigned long pages, filled, ret;
669668

670-
pagevec_init(&rqstp->rq_pvec);
671-
672669
pages = (serv->sv_max_mesg + 2 * PAGE_SIZE) >> PAGE_SHIFT;
673670
if (pages > RPCSVC_MAXPAGES) {
674671
pr_warn_once("svc: warning: pages=%lu > RPCSVC_MAXPAGES=%lu\n",

0 commit comments

Comments
 (0)