]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
SUNRPC: Update svcxdr_init_decode() to call xdr_set_scratch_folio()
authorAnna Schumaker <anna.schumaker@oracle.com>
Mon, 30 Jun 2025 18:53:09 +0000 (14:53 -0400)
committerAnna Schumaker <anna.schumaker@oracle.com>
Tue, 23 Sep 2025 17:29:50 +0000 (13:29 -0400)
The only snag here is that __folio_alloc_node() doesn't handle
NUMA_NO_NODE, so I also need to update svc_pool_map_get_node() to return
numa_mem_id() instead. I arrived at this approach by  looking at what
other users of __folio_alloc_node() do for this case.

Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
include/linux/sunrpc/svc.h
net/sunrpc/svc.c

index 40cbe81360ed493bc16e64b55818b21372e305f9..5506d20857c318774cd223272d4b0022cc19ffb8 100644 (file)
@@ -196,7 +196,7 @@ struct svc_rqst {
        struct xdr_buf          rq_arg;
        struct xdr_stream       rq_arg_stream;
        struct xdr_stream       rq_res_stream;
-       struct page             *rq_scratch_page;
+       struct folio            *rq_scratch_folio;
        struct xdr_buf          rq_res;
        unsigned long           rq_maxpages;    /* num of entries in rq_pages */
        struct page *           *rq_pages;
@@ -503,7 +503,7 @@ static inline void svcxdr_init_decode(struct svc_rqst *rqstp)
        buf->len = buf->head->iov_len + buf->page_len + buf->tail->iov_len;
 
        xdr_init_decode(xdr, buf, argv->iov_base, NULL);
-       xdr_set_scratch_page(xdr, rqstp->rq_scratch_page);
+       xdr_set_scratch_folio(xdr, rqstp->rq_scratch_folio);
 }
 
 /**
index 9c7245d811eb65b501472190b626241b307a6ed8..de05ef637bdc442722a2c96d7aab5beba0f68a02 100644 (file)
@@ -352,7 +352,7 @@ static int svc_pool_map_get_node(unsigned int pidx)
                if (m->mode == SVC_POOL_PERNODE)
                        return m->pool_to[pidx];
        }
-       return NUMA_NO_NODE;
+       return numa_mem_id();
 }
 /*
  * Set the given thread's cpus_allowed mask so that it
@@ -669,8 +669,8 @@ svc_rqst_free(struct svc_rqst *rqstp)
        folio_batch_release(&rqstp->rq_fbatch);
        kfree(rqstp->rq_bvec);
        svc_release_buffer(rqstp);
-       if (rqstp->rq_scratch_page)
-               put_page(rqstp->rq_scratch_page);
+       if (rqstp->rq_scratch_folio)
+               folio_put(rqstp->rq_scratch_folio);
        kfree(rqstp->rq_resp);
        kfree(rqstp->rq_argp);
        kfree(rqstp->rq_auth_data);
@@ -691,8 +691,8 @@ svc_prepare_thread(struct svc_serv *serv, struct svc_pool *pool, int node)
        rqstp->rq_server = serv;
        rqstp->rq_pool = pool;
 
-       rqstp->rq_scratch_page = alloc_pages_node(node, GFP_KERNEL, 0);
-       if (!rqstp->rq_scratch_page)
+       rqstp->rq_scratch_folio = __folio_alloc_node(GFP_KERNEL, 0, node);
+       if (!rqstp->rq_scratch_folio)
                goto out_enomem;
 
        rqstp->rq_argp = kmalloc_node(serv->sv_xdrsize, GFP_KERNEL, node);