Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+7 -7
+2 -2
include/linux/sunrpc/svc.h
··· 196 196 struct xdr_buf rq_arg; 197 197 struct xdr_stream rq_arg_stream; 198 198 struct xdr_stream rq_res_stream; 199 - struct page *rq_scratch_page; 199 + struct folio *rq_scratch_folio; 200 200 struct xdr_buf rq_res; 201 201 unsigned long rq_maxpages; /* num of entries in rq_pages */ 202 202 struct page * *rq_pages; ··· 503 503 buf->len = buf->head->iov_len + buf->page_len + buf->tail->iov_len; 504 504 505 505 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); 507 507 } 508 508 509 509 /**
+5 -5
net/sunrpc/svc.c
··· 352 352 if (m->mode == SVC_POOL_PERNODE) 353 353 return m->pool_to[pidx]; 354 354 } 355 - return NUMA_NO_NODE; 355 + return numa_mem_id(); 356 356 } 357 357 /* 358 358 * Set the given thread's cpus_allowed mask so that it ··· 669 669 folio_batch_release(&rqstp->rq_fbatch); 670 670 kfree(rqstp->rq_bvec); 671 671 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); 674 674 kfree(rqstp->rq_resp); 675 675 kfree(rqstp->rq_argp); 676 676 kfree(rqstp->rq_auth_data); ··· 691 691 rqstp->rq_server = serv; 692 692 rqstp->rq_pool = pool; 693 693 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) 696 696 goto out_enomem; 697 697 698 698 rqstp->rq_argp = kmalloc_node(serv->sv_xdrsize, GFP_KERNEL, node);