Skip to content

Commit d57e43b

Browse files
author
Anna Schumaker
committed
SUNRPC: Update svcxdr_init_decode() to call xdr_set_scratch_folio()
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>
1 parent 4b7c3b4 commit d57e43b

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

include/linux/sunrpc/svc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ struct svc_rqst {
196196
struct xdr_buf rq_arg;
197197
struct xdr_stream rq_arg_stream;
198198
struct xdr_stream rq_res_stream;
199-
struct page *rq_scratch_page;
199+
struct folio *rq_scratch_folio;
200200
struct xdr_buf rq_res;
201201
unsigned long rq_maxpages; /* num of entries in rq_pages */
202202
struct page * *rq_pages;
@@ -503,7 +503,7 @@ static inline void svcxdr_init_decode(struct svc_rqst *rqstp)
503503
buf->len = buf->head->iov_len + buf->page_len + buf->tail->iov_len;
504504

505505
xdr_init_decode(xdr, buf, argv->iov_base, NULL);
506-
xdr_set_scratch_page(xdr, rqstp->rq_scratch_page);
506+
xdr_set_scratch_folio(xdr, rqstp->rq_scratch_folio);
507507
}
508508

509509
/**

net/sunrpc/svc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ static int svc_pool_map_get_node(unsigned int pidx)
352352
if (m->mode == SVC_POOL_PERNODE)
353353
return m->pool_to[pidx];
354354
}
355-
return NUMA_NO_NODE;
355+
return numa_mem_id();
356356
}
357357
/*
358358
* Set the given thread's cpus_allowed mask so that it
@@ -669,8 +669,8 @@ svc_rqst_free(struct svc_rqst *rqstp)
669669
folio_batch_release(&rqstp->rq_fbatch);
670670
kfree(rqstp->rq_bvec);
671671
svc_release_buffer(rqstp);
672-
if (rqstp->rq_scratch_page)
673-
put_page(rqstp->rq_scratch_page);
672+
if (rqstp->rq_scratch_folio)
673+
folio_put(rqstp->rq_scratch_folio);
674674
kfree(rqstp->rq_resp);
675675
kfree(rqstp->rq_argp);
676676
kfree(rqstp->rq_auth_data);
@@ -691,8 +691,8 @@ svc_prepare_thread(struct svc_serv *serv, struct svc_pool *pool, int node)
691691
rqstp->rq_server = serv;
692692
rqstp->rq_pool = pool;
693693

694-
rqstp->rq_scratch_page = alloc_pages_node(node, GFP_KERNEL, 0);
695-
if (!rqstp->rq_scratch_page)
694+
rqstp->rq_scratch_folio = __folio_alloc_node(GFP_KERNEL, 0, node);
695+
if (!rqstp->rq_scratch_folio)
696696
goto out_enomem;
697697

698698
rqstp->rq_argp = kmalloc_node(serv->sv_xdrsize, GFP_KERNEL, node);

0 commit comments

Comments
 (0)