RDMA/rw: Fix MR pool exhaustion in bvec RDMA READ path
Subsystems (4)
Chuck Lever
maintainerv2 cover RDMA/rw: Fix MR pool exhaustion in bvec RDMA READ path
From: Chuck Lever <[email protected]>
This series now carries the original fix with review comments addressed, and a proposal for using contiguous pages for RDMA Read sink buffers in svcrdma. IMO the fix patch should go into 7.0-rc, and the RDMA Read behavior change can wait for the next merge window.
Base commit: v7.0-rc3
---
Changes since v1:
- Clarify code comments
- Allocate contiguous pages for RDMA Read sink buffers
Chuck Lever (2):
RDMA/rw: Fix MR pool exhaustion in bvec RDMA READ path
svcrdma: Use contiguous pages for RDMA Read sink buffers
drivers/infiniband/core/rw.c | 16 ++- net/sunrpc/xprtrdma/svc_rdma_rw.c | 220 ++++++++++++++++++++++++++++++ 2 files changed, 229 insertions(+), 7 deletions(-)
Signature · 1 line
2.52.0
Chuck Lever
maintainerPATCH v2 1/2 RDMA/rw: Fix MR pool exhaustion in bvec RDMA READ path
From: Chuck Lever <[email protected]>
When IOVA-based DMA mapping is unavailable (e.g., IOMMU passthrough mode), rdma_rw_ctx_init_bvec() falls back to checking rdma_rw_io_needs_mr() with the raw bvec count. Unlike the scatterlist path in rdma_rw_ctx_init(), which passes a post-DMA-mapping entry count that reflects coalescing of physically contiguous pages, the bvec path passes the pre-mapping page count. This overstates the number of DMA entries, causing every multi-bvec RDMA READ to consume an MR from the QP's pool.
Under NFS WRITE workloads the server performs RDMA READs to pull data from the client. With the inflated MR demand, the pool is rapidly exhausted, ib_mr_pool_get() returns NULL, and rdma_rw_init_one_mr() returns -EAGAIN. svcrdma treats this as a DMA mapping failure, closes the connection, and the client reconnects -- producing a cycle of 71% RPC retransmissions and ~100 reconnections per test run. RDMA WRITEs (NFS READ direction) are unaffected because DMA_TO_DEVICE never triggers the max_sgl_rd check.
Remove the rdma_rw_io_needs_mr() gate from the bvec path entirely, so that bvec RDMA operations always use the map_wrs path (direct WR posting without MR allocation). The bvec caller has no post-DMA-coalescing segment count available -- xdr_buf and svc_rqst hold pages as individual pointers, and physical contiguity is discovered only during DMA mapping -- so the raw page count cannot serve as a reliable input to rdma_rw_io_needs_mr(). iWARP devices, which require MRs unconditionally, are handled by an earlier check in rdma_rw_ctx_init_bvec() and are unaffected.
--- drivers/infiniband/core/rw.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/infiniband/core/rw.c +9 -7
@@ -686,14 +686,16 @@ int rdma_rw_ctx_init_bvec(struct rdma_rw_ctx *ctx, struct ib_qp *qp,return ret;/* -* IOVA mapping not available. Check if MR registration provides -* better performance than multiple SGE entries. +* IOVA not available; fall back to the map_wrs path, which maps +* each bvec as a direct SGE. This is always correct: the MR path +* is a throughput optimization, not a correctness requirement. +* (iWARP, which does require MRs, is handled by the check above.) +* +* The rdma_rw_io_needs_mr() gate is not used here because nr_bvec +* is a raw page count that overstates DMA entry demand -- the bvec +* caller has no post-DMA-coalescing segment count, and feeding the +* inflated count into the MR path exhausts the pool on RDMA READs. */ -if (rdma_rw_io_needs_mr (dev, port_num, dir, nr_bvec)) -return rdma_rw_init_mr_wrs_bvec (ctx, qp, port_num, bvecs, - nr_bvec, &iter, remote_addr, - rkey, dir); -return rdma_rw_init_map_wrs_bvec (ctx, qp, bvecs, nr_bvec, &iter, remote_addr, rkey, dir); }
Signature · 1 line
2.52.0
Chuck Lever
maintainerPATCH v2 2/2 svcrdma: Use contiguous pages for RDMA Read sink buffers
In reply to Chuck LeverFrom: Chuck Lever <[email protected]>
svc_rdma_build_read_segment() constructs RDMA Read sink buffers by consuming pages one-at-a-time from rq_pages[] and building one bvec per page. A 64KB NFS READ payload produces 16 separate bvecs, 16 DMA mappings, and potentially multiple RDMA Read WRs.
A single higher-order allocation followed by split_page() yields physically contiguous memory while preserving per-page refcounts. A single bvec spanning the contiguous range causes rdma_rw_ctx_init_bvec() to take the rdma_rw_init_single_wr_bvec() fast path: one DMA mapping, one SGE, one WR.
The split sub-pages replace the original rq_pages[] entries, so all downstream page tracking, completion handling, and xdr_buf assembly remain unchanged.
Allocation uses __GFP_NORETRY | __GFP_NOWARN and falls back through decreasing orders. If even order-1 fails, the existing per-page path handles the segment.
When nr_pages is not a power of two, get_order() rounds up and the allocation yields more pages than needed. The extra split pages replace existing rq_pages[] entries (freed via put_page() first), so there is no net increase in per- request page consumption. Successive segments reuse the same padding slots, preventing accumulation. The rq_maxpages guard rejects any allocation that would overrun the array, falling back to the per-page path. Under memory pressure, __GFP_NORETRY causes the higher- order allocation to fail without stalling.
The contiguous path is attempted when the segment starts page-aligned (rc_pageoff == 0) and spans at least two pages. NFS WRITE segments carry application-modified byte ranges of arbitrary length, so the optimization is not restricted to power-of-two page counts.
--- net/sunrpc/xprtrdma/svc_rdma_rw.c | 220 ++++++++++++++++++++++++++++++ 1 file changed, 220 insertions(+)
net/sunrpc/xprtrdma/svc_rdma_rw.c +220 -0
@@ -732,6 +732,216 @@ int svc_rdma_prepare_reply_chunk(struct svcxprt_rdma *rdma,return xdr->len; } +#if PAGE_SIZE <SZ_64K + +/* +* Limit contiguous RDMA Read sink allocations to 64KB +* (order-4 on 4KB-page systems). Higher orders risk +* allocation failure under __GFP_NORETRY, which would +* negate the benefit of the contiguous fast path. +*/ +#define SVC_RDMA_CONTIG_MAX_ORDER get_order(SZ_64K) + +/** +* svc_rdma_alloc_read_pages - Allocate physically contiguous pages +* @nr_pages: number of pages needed +* @order: on success, set to the allocation order +* +* Attempts a higher-order allocation, falling back to smaller orders. +* The returned pages are split immediately so each sub-page has its +* own refcount and can be freed independently. +* +* Returns a pointer to the first page on success, or NULL if even +* order-1 allocation fails. +*/ +static struct page * +svc_rdma_alloc_read_pages (unsigned int nr_pages,unsigned int *order) +{ +unsigned int o; +struct page *page; + + o =get_order (nr_pages <<PAGE_SHIFT ); +if (o >SVC_RDMA_CONTIG_MAX_ORDER ) + o =SVC_RDMA_CONTIG_MAX_ORDER ; + +while (o >=1 ) { + page =alloc_pages (GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN, + o); +if (page) { +split_page (page, o); + *order = o; +return page; + } + o--; + } +return NULL ; +} + +/* +* svc_rdma_fill_contig_bvec - Replace rq_pages with a contiguous allocation +* @rqstp: RPC transaction context +* @head: context for ongoing I/O +* @bv: bvec entry to fill +* @pages_left: number of data pages remaining in the segment +* @len_left: bytes remaining in the segment +* +* On success, fills @bv with a bvec spanning the contiguous range and +* advances rc_curpage/rc_page_count. Returns the byte length covered, +* or zero if the allocation failed or would overrun rq_maxpages. +*/ +static unsigned int +svc_rdma_fill_contig_bvec (struct svc_rqst *rqstp, +struct svc_rdma_recv_ctxt *head, +struct bio_vec *bv,unsigned int pages_left, +unsigned int len_left) +{ +unsigned int order, alloc_nr, chunk_pages, chunk_len, i; +struct page *page; + + page =svc_rdma_alloc_read_pages (pages_left, &order); +if (!page) +return 0 ; + alloc_nr =1 << order; + +if (head->rc_curpage + alloc_nr > rqstp->rq_maxpages) { +for (i =0 ; i < alloc_nr; i++) +__free_page (page + i); +return 0 ; + } + +for (i =0 ; i < alloc_nr; i++) { +svc_rqst_page_release (rqstp, + rqstp->rq_pages[head->rc_curpage + i]); + rqstp->rq_pages[head->rc_curpage + i] = page + i; + } + + chunk_pages =min (alloc_nr, pages_left); + chunk_len = min_t(unsigned int, chunk_pages << PAGE_SHIFT, len_left); +bvec_set_page (bv, page, chunk_len,0 ); + head->rc_page_count += chunk_pages; + head->rc_curpage += chunk_pages; +return chunk_len; +} + +/* +* svc_rdma_fill_page_bvec - Add a single rq_page to the bvec array +* @head: context for ongoing I/O +* @ctxt: R/W context whose bvec array is being filled +* @cur: page to add +* @bvec_idx: pointer to current bvec index, not advanced on merge +* @len_left: bytes remaining in the segment +* +* If @cur is physically contiguous with the preceding bvec, it is +* merged by extending that bvec's length. Otherwise a new bvec +* entry is created. Returns the byte length covered. +*/ +static unsigned int +svc_rdma_fill_page_bvec (struct svc_rdma_recv_ctxt *head, +struct svc_rdma_rw_ctxt *ctxt,struct page *cur, +unsigned int *bvec_idx,unsigned int len_left) +{ + unsigned int chunk_len = min_t(unsigned int, PAGE_SIZE, len_left); + + head->rc_page_count++; + head->rc_curpage++; + +if (*bvec_idx >0 ) { +struct bio_vec *prev = &ctxt->rw_bvec[*bvec_idx -1 ]; + +if (page_to_phys (prev->bv_page) + prev->bv_offset + + prev->bv_len ==page_to_phys (cur)) { + prev->bv_len += chunk_len; +return chunk_len; + } + } + +bvec_set_page (&ctxt->rw_bvec[*bvec_idx], cur, chunk_len,0 ); + (*bvec_idx)++; +return chunk_len; +} + +/** +* svc_rdma_build_read_segment_contig - Build RDMA Read WR with contiguous pages +* @rqstp: RPC transaction context +* @head: context for ongoing I/O +* @segment: co-ordinates of remote memory to be read +* +* Greedily allocates higher-order pages to cover the segment, +* building one bvec per contiguous chunk. Each allocation is +* split so sub-pages have independent refcounts. When a +* higher-order allocation fails, remaining pages are covered +* individually, merging adjacent pages into the preceding bvec +* when they are physically contiguous. The split sub-pages +* replace entries in rq_pages[] so downstream cleanup is +* unchanged. +* +* Returns: +* %0: the Read WR was constructed successfully +* %-ENOMEM: allocation failed +* %-EIO: a DMA mapping error occurred +*/ +static int svc_rdma_build_read_segment_contig (struct svc_rqst *rqstp, +struct svc_rdma_recv_ctxt *head, +const struct svc_rdma_segment *segment) +{ +struct svcxprt_rdma *rdma =svc_rdma_rqst_rdma (rqstp); +struct svc_rdma_chunk_ctxt *cc = &head->rc_cc; +unsigned int nr_data_pages, bvec_idx; +struct svc_rdma_rw_ctxt *ctxt; +unsigned int len_left; +int ret; + + nr_data_pages =PAGE_ALIGN (segment->rs_length) >>PAGE_SHIFT ; +if (head->rc_curpage + nr_data_pages > rqstp->rq_maxpages) +return -ENOMEM ; + + ctxt =svc_rdma_get_rw_ctxt (rdma, nr_data_pages); +if (!ctxt) +return -ENOMEM ; + + bvec_idx =0 ; + len_left = segment->rs_length; +while (len_left) { +unsigned int pages_left =PAGE_ALIGN (len_left) >>PAGE_SHIFT ; +unsigned int chunk_len =0 ; + +if (pages_left >=2 ) + chunk_len =svc_rdma_fill_contig_bvec (rqstp, head, + &ctxt->rw_bvec[bvec_idx], + pages_left, len_left); +if (chunk_len) { + bvec_idx++; + }else { +struct page *cur = + rqstp->rq_pages[head->rc_curpage]; + chunk_len =svc_rdma_fill_page_bvec (head, ctxt, cur, + &bvec_idx, + len_left); + } + + len_left -= chunk_len; + } + + ctxt->rw_nents = bvec_idx; + + head->rc_pageoff =offset_in_page (segment->rs_length); +if (head->rc_pageoff) + head->rc_curpage--; + + ret =svc_rdma_rw_ctx_init (rdma, ctxt, segment->rs_offset, + segment->rs_handle, segment->rs_length, +DMA_FROM_DEVICE ); +if (ret <0 ) +return -EIO ; +percpu_counter_inc (&svcrdma_stat_read); + +list_add (&ctxt->rw_list, &cc->cc_rwctxts); + cc->cc_sqecount += ret; +return 0 ; +} + +#endif /* PAGE_SIZE < SZ_64K */ +/** * svc_rdma_build_read_segment - Build RDMA Read WQEs to pull one RDMA segment * @rqstp: RPC transaction context
@@ -758,6 +968,16 @@ static int svc_rdma_build_read_segment(struct svc_rqst *rqstp,if (check_add_overflow (head->rc_pageoff, len, &total))return -EINVAL ; nr_bvec =PAGE_ALIGN (total) >>PAGE_SHIFT ; + +#if PAGE_SIZE <SZ_64K +if (head->rc_pageoff ==0 && nr_bvec >=2 ) { + ret =svc_rdma_build_read_segment_contig (rqstp, head, + segment); +if (ret != -ENOMEM ) +return ret; + } +#endif + ctxt =svc_rdma_get_rw_ctxt (rdma, nr_bvec);if (!ctxt)return -ENOMEM ;
Signature · 1 line
2.52.0
kernel test robot
build botRe: [PATCH v2 2/2] svcrdma: Use contiguous pages for RDMA Read sink buffers
kernel test robot noticed the following build errors:
Hi Chuck,
kernel test robot noticed the following build errors:
[auto build test ERROR on v7.0-rc1]
[also build test ERROR on next-20260312]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Chuck-Lever/RDMA-rw-Fix-MR-pool-exhaustion-in-bvec-RDMA-READ-path/20260313-085521 base: v7.0-rc1 patch link: https://lore.kernel.org/r/20260312134008.7387-3-cel%40kernel.org patch subject: [PATCH v2 2/2] svcrdma: Use contiguous pages for RDMA Read sink buffers config: x86_64-rhel-9.4 (https://download.01.org/0day-ci/archive/20260313/[email protected]/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260313/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
net/sunrpc/xprtrdma/svc_rdma_rw.c: In function 'svc_rdma_fill_contig_bvec':
>> net/sunrpc/xprtrdma/svc_rdma_rw.c:813:17: error: implicit declaration of function 'svc_rqst_page_release'; did you mean 'svc_rdma_cc_release'? [-Wimplicit-function-declaration]
813 | svc_rqst_page_release(rqstp,
| ^~~~~~~~~~~~~~~~~~~~~
| svc_rdma_cc_releasevim +813 net/sunrpc/xprtrdma/svc_rdma_rw.c
779
780 /*
781 * svc_rdma_fill_contig_bvec - Replace rq_pages with a contiguous allocation
782 * @rqstp: RPC transaction context
783 * @head: context for ongoing I/O
784 * @bv: bvec entry to fill
785 * @pages_left: number of data pages remaining in the segment
786 * @len_left: bytes remaining in the segment
787 *
788 * On success, fills @bv with a bvec spanning the contiguous range and
789 * advances rc_curpage/rc_page_count. Returns the byte length covered,
790 * or zero if the allocation failed or would overrun rq_maxpages.
791 */
792 static unsigned int
793 svc_rdma_fill_contig_bvec(struct svc_rqst *rqstp,
794 struct svc_rdma_recv_ctxt *head,
795 struct bio_vec *bv, unsigned int pages_left,
796 unsigned int len_left)
797 {
798 unsigned int order, alloc_nr, chunk_pages, chunk_len, i;
799 struct page *page;
800
801 page = svc_rdma_alloc_read_pages(pages_left, &order);
802 if (!page)
803 return 0;
804 alloc_nr = 1 << order;
805
806 if (head->rc_curpage + alloc_nr > rqstp->rq_maxpages) {
807 for (i = 0; i < alloc_nr; i++)
808 __free_page(page + i);
809 return 0;
810 }
811
812 for (i = 0; i < alloc_nr; i++) {
> 813 svc_rqst_page_release(rqstp, 814 rqstp->rq_pages[head->rc_curpage + i]);
815 rqstp->rq_pages[head->rc_curpage + i] = page + i;
816 }
817
818 chunk_pages = min(alloc_nr, pages_left);
819 chunk_len = min_t(unsigned int, chunk_pages << PAGE_SHIFT, len_left);
820 bvec_set_page(bv, page, chunk_len, 0);
821 head->rc_page_count += chunk_pages;
822 head->rc_curpage += chunk_pages;
823 return chunk_len;
824 }
825
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Chuck Lever
maintainerRe: [PATCH v2 2/2] svcrdma: Use contiguous pages for RDMA Read sink buffers
Quoted 30 lines · kernel test robot
Hi Chuck,
kernel test robot noticed the following build errors:
[auto build test ERROR on v7.0-rc1]
[also build test ERROR on next-20260312]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]url:
https://github.com/intel-lab-lkp/linux/commits/Chuck-Lever/RDMA-rw-Fix-MR-pool-exhaustion-in-bvec-RDMA-READ-path/20260313-085521
base: v7.0-rc1
patch link:
https://lore.kernel.org/r/20260312134008.7387-3-cel%40kernel.org
patch subject: [PATCH v2 2/2] svcrdma: Use contiguous pages for RDMA Read sink buffers
config: x86_64-rhel-9.4
(https://download.01.org/0day-ci/archive/20260313/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build):
(https://download.01.org/0day-ci/archive/20260313/[email protected]/reproduce)If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes:
https://lore.kernel.org/oe-kbuild-all/[email protected]/
Quoted 7 lines
All errors (new ones prefixed by >>):
net/sunrpc/xprtrdma/svc_rdma_rw.c: In function 'svc_rdma_fill_contig_bvec':Quoted 1 line
Quoted 1 line
net/sunrpc/xprtrdma/svc_rdma_rw.c:813:17: error: implicit declaration of function 'svc_rqst_page_release'; did you mean 'svc_rdma_cc_release'? [-Wimplicit-function-declaration]813 | svc_rqst_page_release(rqstp, | ^~~~~~~~~~~~~~~~~~~~~ | svc_rdma_cc_release
The current version of the series is missing a patch that provides this helper function. Next version (if one is needed) will include it.
Quoted 57 lines
vim +813
net/sunrpc/xprtrdma/svc_rdma_rw.c779 780 /* 781 * svc_rdma_fill_contig_bvec - Replace rq_pages with acontiguous allocation
782 * @rqstp: RPC transaction context
783 * @head: context for ongoing I/O
784 * @bv: bvec entry to fill
785 * @pages_left: number of data pages remaining in the segment
786 * @len_left: bytes remaining in the segment
787 *
788 * On success, fills @bv with a bvec spanning the contiguous
range and
789 * advances rc_curpage/rc_page_count. Returns the byte length
covered,
790 * or zero if the allocation failed or would overrunrq_maxpages.
791 */
792 static unsigned int
793 svc_rdma_fill_contig_bvec(structsvc_rqst*rqstp,794 struct svc_rdma_recv_ctxt *head, 795 struct bio_vec *bv, unsigned int pages_left, 796 unsigned int len_left) 797 { 798 unsigned int order, alloc_nr, chunk_pages, chunk_len, i; 799 struct page *page; 800 801 page = svc_rdma_alloc_read_pages(pages_left, &order); 802 if (!page) 803 return 0; 804 alloc_nr = 1 << order; 805 806 if (head->rc_curpage + alloc_nr > rqstp->rq_maxpages) { 807 for (i = 0; i < alloc_nr; i++) 808 __free_page(page + i); 809 return 0; 810 } 811 812 for (i = 0; i < alloc_nr; i++) {Quoted 1 line
813 svc_rqst_page_release(rqstp,
814 rqstp->rq_pages[head->rc_curpage + i]); 815 rqstp->rq_pages[head->rc_curpage + i] = page + i; 816 } 817 818 chunk_pages = min(alloc_nr, pages_left); 819 chunk_len = min_t(unsigned int, chunk_pages << PAGE_SHIFT, len_left); 820 bvec_set_page(bv, page, chunk_len, 0); 821 head->rc_page_count += chunk_pages; 822 head->rc_curpage += chunk_pages; 823 return chunk_len; 824 } 825Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Signature · 1 line
Chuck Lever
kernel test robot
build botRe: [PATCH v2 2/2] svcrdma: Use contiguous pages for RDMA Read sink buffers
In reply to Chuck Leverkernel test robot noticed the following build errors:
Hi Chuck,
kernel test robot noticed the following build errors:
[auto build test ERROR on v7.0-rc1]
[also build test ERROR on next-20260311]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Chuck-Lever/RDMA-rw-Fix-MR-pool-exhaustion-in-bvec-RDMA-READ-path/20260313-085521 base: v7.0-rc1 patch link: https://lore.kernel.org/r/20260312134008.7387-3-cel%40kernel.org patch subject: [PATCH v2 2/2] svcrdma: Use contiguous pages for RDMA Read sink buffers config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20260314/[email protected]/config) compiler: m68k-linux-gcc (GCC) 15.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260314/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
net/sunrpc/xprtrdma/svc_rdma_rw.c: In function 'svc_rdma_fill_contig_bvec':
>> net/sunrpc/xprtrdma/svc_rdma_rw.c:813:17: error: implicit declaration of function 'svc_rqst_page_release'; did you mean 'svc_rdma_cc_release'? [-Wimplicit-function-declaration]
813 | svc_rqst_page_release(rqstp,
| ^~~~~~~~~~~~~~~~~~~~~
| svc_rdma_cc_releasevim +813 net/sunrpc/xprtrdma/svc_rdma_rw.c
779
780 /*
781 * svc_rdma_fill_contig_bvec - Replace rq_pages with a contiguous allocation
782 * @rqstp: RPC transaction context
783 * @head: context for ongoing I/O
784 * @bv: bvec entry to fill
785 * @pages_left: number of data pages remaining in the segment
786 * @len_left: bytes remaining in the segment
787 *
788 * On success, fills @bv with a bvec spanning the contiguous range and
789 * advances rc_curpage/rc_page_count. Returns the byte length covered,
790 * or zero if the allocation failed or would overrun rq_maxpages.
791 */
792 static unsigned int
793 svc_rdma_fill_contig_bvec(struct svc_rqst *rqstp,
794 struct svc_rdma_recv_ctxt *head,
795 struct bio_vec *bv, unsigned int pages_left,
796 unsigned int len_left)
797 {
798 unsigned int order, alloc_nr, chunk_pages, chunk_len, i;
799 struct page *page;
800
801 page = svc_rdma_alloc_read_pages(pages_left, &order);
802 if (!page)
803 return 0;
804 alloc_nr = 1 << order;
805
806 if (head->rc_curpage + alloc_nr > rqstp->rq_maxpages) {
807 for (i = 0; i < alloc_nr; i++)
808 __free_page(page + i);
809 return 0;
810 }
811
812 for (i = 0; i < alloc_nr; i++) {
> 813 svc_rqst_page_release(rqstp, 814 rqstp->rq_pages[head->rc_curpage + i]);
815 rqstp->rq_pages[head->rc_curpage + i] = page + i;
816 }
817
818 chunk_pages = min(alloc_nr, pages_left);
819 chunk_len = min_t(unsigned int, chunk_pages << PAGE_SHIFT, len_left);
820 bvec_set_page(bv, page, chunk_len, 0);
821 head->rc_page_count += chunk_pages;
822 head->rc_curpage += chunk_pages;
823 return chunk_len;
824 }
825
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH v2 2/2] svcrdma: Use contiguous pages for RDMA Read sink buffers
In reply to Chuck Leverkernel test robot noticed the following build errors:
Hi Chuck,
kernel test robot noticed the following build errors:
[auto build test ERROR on v7.0-rc1]
[also build test ERROR on next-20260311]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Chuck-Lever/RDMA-rw-Fix-MR-pool-exhaustion-in-bvec-RDMA-READ-path/20260313-085521 base: v7.0-rc1 patch link: https://lore.kernel.org/r/20260312134008.7387-3-cel%40kernel.org patch subject: [PATCH v2 2/2] svcrdma: Use contiguous pages for RDMA Read sink buffers config: riscv-allyesconfig (https://download.01.org/0day-ci/archive/20260314/[email protected]/config) compiler: clang version 16.0.6 (https://github.com/llvm/llvm-project 7cbf1a2591520c2491aa35339f227775f4d3adf6) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260314/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
>> net/sunrpc/xprtrdma/svc_rdma_rw.c:813:3: error: call to undeclared function 'svc_rqst_page_release'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
svc_rqst_page_release(rqstp,
^
net/sunrpc/xprtrdma/svc_rdma_rw.c:813:3: note: did you mean 'svc_rdma_cc_release'?
net/sunrpc/xprtrdma/svc_rdma_rw.c:193:6: note: 'svc_rdma_cc_release' declared here
void svc_rdma_cc_release(struct svcxprt_rdma *rdma,
^1 error generated.
vim +/svc_rqst_page_release +813 net/sunrpc/xprtrdma/svc_rdma_rw.c
779
780 /*
781 * svc_rdma_fill_contig_bvec - Replace rq_pages with a contiguous allocation
782 * @rqstp: RPC transaction context
783 * @head: context for ongoing I/O
784 * @bv: bvec entry to fill
785 * @pages_left: number of data pages remaining in the segment
786 * @len_left: bytes remaining in the segment
787 *
788 * On success, fills @bv with a bvec spanning the contiguous range and
789 * advances rc_curpage/rc_page_count. Returns the byte length covered,
790 * or zero if the allocation failed or would overrun rq_maxpages.
791 */
792 static unsigned int
793 svc_rdma_fill_contig_bvec(struct svc_rqst *rqstp,
794 struct svc_rdma_recv_ctxt *head,
795 struct bio_vec *bv, unsigned int pages_left,
796 unsigned int len_left)
797 {
798 unsigned int order, alloc_nr, chunk_pages, chunk_len, i;
799 struct page *page;
800
801 page = svc_rdma_alloc_read_pages(pages_left, &order);
802 if (!page)
803 return 0;
804 alloc_nr = 1 << order;
805
806 if (head->rc_curpage + alloc_nr > rqstp->rq_maxpages) {
807 for (i = 0; i < alloc_nr; i++)
808 __free_page(page + i);
809 return 0;
810 }
811
812 for (i = 0; i < alloc_nr; i++) {
> 813 svc_rqst_page_release(rqstp, 814 rqstp->rq_pages[head->rc_curpage + i]);
815 rqstp->rq_pages[head->rc_curpage + i] = page + i;
816 }
817
818 chunk_pages = min(alloc_nr, pages_left);
819 chunk_len = min_t(unsigned int, chunk_pages << PAGE_SHIFT, len_left);
820 bvec_set_page(bv, page, chunk_len, 0);
821 head->rc_page_count += chunk_pages;
822 head->rc_curpage += chunk_pages;
823 return chunk_len;
824 }
825
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki