Skip to content

Commit 04d0ea3

Browse files
committed
Merge: SUNRPC: Cleanup/fix initial rq_pages allocation
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7068 JIRA: https://issues.redhat.com/browse/RHEL-91267 Conflicts: This RHEL-9 version is quite a bit different from the upstream version because the original fix for this problem conflicted with a series to "Allocate payload arrays dynamically": https://lore.kernel.org/linux-nfs/[email protected]/ Thus, the upstream fix referenced here keeps svc_init_buffer to allow the page array allocation. We're not ready for this new work to land in RHEL-9 and if we do take it we'll need to take this fix again afterward. This version corresponds to the v1 fix posted here: https://lore.kernel.org/linux-nfs/458f45b2b7259c17555dd65aa7cdbbf1a459d5e6.1749131924.git.bcodding@redhat.com/ The result is the same - we don't do the bulk array allocation in svc_init_buffer() because we lack the required retry logic to allocate the whole range. commit 8b3ac9f Author: Benjamin Coddington <[email protected]> Date: Mon Jun 9 13:21:56 2025 -0400 SUNRPC: Cleanup/fix initial rq_pages allocation While investigating some reports of memory-constrained NUMA machines failing to mount v3 and v4.0 nfs mounts, we found that svc_init_buffer() was not attempting to retry allocations from the bulk page allocator. Typically, this results in a single page allocation being returned and the mount attempt fails with -ENOMEM. A retry would have allowed the mount to succeed. Additionally, it seems that the bulk allocation in svc_init_buffer() is redundant because svc_alloc_arg() will perform the required allocation and does the correct thing to retry the allocations. The call to allocate memory in svc_alloc_arg() drops the preferred node argument, but I expect we'll still allocate on the preferred node because the allocation call happens within the svc thread context, which chooses the node with memory closest to the current thread's execution. This patch cleans out the bulk allocation in svc_init_buffer() to allow svc_alloc_arg() to handle the allocation/retry logic for rq_pages. Signed-off-by: Benjamin Coddington <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Fixes: ed603bc ("sunrpc: Replace the rq_pages array with dynamically-allocated memory") Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: Benjamin Coddington <[email protected]> Approved-by: Olga Kornievskaia <[email protected]> Approved-by: Paulo Alcantara <[email protected]> Approved-by: Scott Mayhew <[email protected]> Approved-by: CKI KWF Bot <[email protected]> Merged-by: Augusto Caringi <[email protected]>
2 parents 880b1c0 + 0dab671 commit 04d0ea3

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

net/sunrpc/svc.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -630,27 +630,6 @@ svc_destroy(struct svc_serv **servp)
630630
}
631631
EXPORT_SYMBOL_GPL(svc_destroy);
632632

633-
static bool
634-
svc_init_buffer(struct svc_rqst *rqstp, unsigned int size, int node)
635-
{
636-
unsigned long pages, ret;
637-
638-
/* bc_xprt uses fore channel allocated buffers */
639-
if (svc_is_backchannel(rqstp))
640-
return true;
641-
642-
pages = size / PAGE_SIZE + 1; /* extra page as we hold both request and reply.
643-
* We assume one is at most one page
644-
*/
645-
WARN_ON_ONCE(pages > RPCSVC_MAXPAGES);
646-
if (pages > RPCSVC_MAXPAGES)
647-
pages = RPCSVC_MAXPAGES;
648-
649-
ret = alloc_pages_bulk_array_node(GFP_KERNEL, node, pages,
650-
rqstp->rq_pages);
651-
return ret == pages;
652-
}
653-
654633
/*
655634
* Release an RPC server buffer
656635
*/
@@ -690,9 +669,6 @@ svc_rqst_alloc(struct svc_serv *serv, struct svc_pool *pool, int node)
690669
if (!rqstp->rq_resp)
691670
goto out_enomem;
692671

693-
if (!svc_init_buffer(rqstp, serv->sv_max_mesg, node))
694-
goto out_enomem;
695-
696672
return rqstp;
697673
out_enomem:
698674
svc_rqst_free(rqstp);

0 commit comments

Comments
 (0)