Skip to content

Commit 88e4d41

Browse files
committed
SUNRPC: Use __alloc_bulk_pages() in svc_init_buffer()
Clean up: Use the bulk page allocator when filling a server thread's buffer page array. Signed-off-by: Chuck Lever <[email protected]>
1 parent 5f7fc5d commit 88e4d41

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

net/sunrpc/svc.c

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -597,34 +597,25 @@ svc_destroy(struct kref *ref)
597597
}
598598
EXPORT_SYMBOL_GPL(svc_destroy);
599599

600-
/*
601-
* Allocate an RPC server's buffer space.
602-
* We allocate pages and place them in rq_pages.
603-
*/
604-
static int
600+
static bool
605601
svc_init_buffer(struct svc_rqst *rqstp, unsigned int size, int node)
606602
{
607-
unsigned int pages, arghi;
603+
unsigned long pages, ret;
608604

609605
/* bc_xprt uses fore channel allocated buffers */
610606
if (svc_is_backchannel(rqstp))
611-
return 1;
607+
return true;
612608

613609
pages = size / PAGE_SIZE + 1; /* extra page as we hold both request and reply.
614610
* We assume one is at most one page
615611
*/
616-
arghi = 0;
617612
WARN_ON_ONCE(pages > RPCSVC_MAXPAGES);
618613
if (pages > RPCSVC_MAXPAGES)
619614
pages = RPCSVC_MAXPAGES;
620-
while (pages) {
621-
struct page *p = alloc_pages_node(node, GFP_KERNEL, 0);
622-
if (!p)
623-
break;
624-
rqstp->rq_pages[arghi++] = p;
625-
pages--;
626-
}
627-
return pages == 0;
615+
616+
ret = alloc_pages_bulk_array_node(GFP_KERNEL, node, pages,
617+
rqstp->rq_pages);
618+
return ret == pages;
628619
}
629620

630621
/*

0 commit comments

Comments
 (0)