|
| 1 | +SUNRPC: Cleanup/fix initial rq_pages allocation |
| 2 | + |
| 3 | +jira LE-4649 |
| 4 | +Rebuild_History Non-Buildable kernel-5.14.0-570.60.1.el9_6 |
| 5 | +commit-author Benjamin Coddington <bcodding@redhat.com> |
| 6 | +commit 8b3ac9fabaa825b7bae850ee7b4580c5cba32699 |
| 7 | +Empty-Commit: Cherry-Pick Conflicts during history rebuild. |
| 8 | +Will be included in final tarball splat. Ref for failed cherry-pick at: |
| 9 | +ciq/ciq_backports/kernel-5.14.0-570.60.1.el9_6/8b3ac9fa.failed |
| 10 | + |
| 11 | +While investigating some reports of memory-constrained NUMA machines |
| 12 | +failing to mount v3 and v4.0 nfs mounts, we found that svc_init_buffer() |
| 13 | +was not attempting to retry allocations from the bulk page allocator. |
| 14 | +Typically, this results in a single page allocation being returned and |
| 15 | +the mount attempt fails with -ENOMEM. A retry would have allowed the mount |
| 16 | +to succeed. |
| 17 | + |
| 18 | +Additionally, it seems that the bulk allocation in svc_init_buffer() is |
| 19 | +redundant because svc_alloc_arg() will perform the required allocation and |
| 20 | +does the correct thing to retry the allocations. |
| 21 | + |
| 22 | +The call to allocate memory in svc_alloc_arg() drops the preferred node |
| 23 | +argument, but I expect we'll still allocate on the preferred node because |
| 24 | +the allocation call happens within the svc thread context, which chooses |
| 25 | +the node with memory closest to the current thread's execution. |
| 26 | + |
| 27 | +This patch cleans out the bulk allocation in svc_init_buffer() to allow |
| 28 | +svc_alloc_arg() to handle the allocation/retry logic for rq_pages. |
| 29 | + |
| 30 | + Signed-off-by: Benjamin Coddington <bcodding@redhat.com> |
| 31 | + Reviewed-by: Jeff Layton <jlayton@kernel.org> |
| 32 | +Fixes: ed603bcf4fea ("sunrpc: Replace the rq_pages array with dynamically-allocated memory") |
| 33 | + Signed-off-by: Chuck Lever <chuck.lever@oracle.com> |
| 34 | +(cherry picked from commit 8b3ac9fabaa825b7bae850ee7b4580c5cba32699) |
| 35 | + Signed-off-by: Jonathan Maple <jmaple@ciq.com> |
| 36 | + |
| 37 | +# Conflicts: |
| 38 | +# net/sunrpc/svc.c |
| 39 | +diff --cc net/sunrpc/svc.c |
| 40 | +index aef501b0904b,ef8a05aac87f..000000000000 |
| 41 | +--- a/net/sunrpc/svc.c |
| 42 | ++++ b/net/sunrpc/svc.c |
| 43 | +@@@ -631,24 -636,18 +631,32 @@@ svc_destroy(struct svc_serv **servp |
| 44 | + EXPORT_SYMBOL_GPL(svc_destroy); |
| 45 | + |
| 46 | + static bool |
| 47 | + -svc_init_buffer(struct svc_rqst *rqstp, const struct svc_serv *serv, int node) |
| 48 | + +svc_init_buffer(struct svc_rqst *rqstp, unsigned int size, int node) |
| 49 | + { |
| 50 | + - rqstp->rq_maxpages = svc_serv_maxpages(serv); |
| 51 | + - |
| 52 | + - /* rq_pages' last entry is NULL for historical reasons. */ |
| 53 | + - rqstp->rq_pages = kcalloc_node(rqstp->rq_maxpages + 1, |
| 54 | + - sizeof(struct page *), |
| 55 | + - GFP_KERNEL, node); |
| 56 | + - if (!rqstp->rq_pages) |
| 57 | + - return false; |
| 58 | +++<<<<<<< HEAD |
| 59 | + + unsigned long pages, ret; |
| 60 | + |
| 61 | + + /* bc_xprt uses fore channel allocated buffers */ |
| 62 | + + if (svc_is_backchannel(rqstp)) |
| 63 | + + return true; |
| 64 | +++======= |
| 65 | +++ rqstp->rq_maxpages = svc_serv_maxpages(serv); |
| 66 | +++>>>>>>> 8b3ac9fabaa8 (SUNRPC: Cleanup/fix initial rq_pages allocation) |
| 67 | + + |
| 68 | + + pages = size / PAGE_SIZE + 1; /* extra page as we hold both request and reply. |
| 69 | + + * We assume one is at most one page |
| 70 | + + */ |
| 71 | + + WARN_ON_ONCE(pages > RPCSVC_MAXPAGES); |
| 72 | + + if (pages > RPCSVC_MAXPAGES) |
| 73 | + + pages = RPCSVC_MAXPAGES; |
| 74 | + + |
| 75 | +++<<<<<<< HEAD |
| 76 | + + ret = alloc_pages_bulk_array_node(GFP_KERNEL, node, pages, |
| 77 | + + rqstp->rq_pages); |
| 78 | + + return ret == pages; |
| 79 | +++======= |
| 80 | ++ return true; |
| 81 | +++>>>>>>> 8b3ac9fabaa8 (SUNRPC: Cleanup/fix initial rq_pages allocation) |
| 82 | + } |
| 83 | + |
| 84 | + /* |
| 85 | +* Unmerged path net/sunrpc/svc.c |
0 commit comments