Skip to content

Commit

Permalink
svcrdma: Clean up allocation of svc_rdma_rw_ctxt
Browse files Browse the repository at this point in the history
The physical device's favored NUMA node ID is available when
allocating a rw_ctxt. Use that value instead of relying on the
assumption that the memory allocation happens to be running on a
node close to the device.

Signed-off-by: Chuck Lever <[email protected]>
  • Loading branch information
chucklever committed Jun 12, 2023
1 parent ed51b42 commit ac3c32b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions net/sunrpc/xprtrdma/svc_rdma_rw.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ svc_rdma_get_rw_ctxt(struct svcxprt_rdma *rdma, unsigned int sges)
if (node) {
ctxt = llist_entry(node, struct svc_rdma_rw_ctxt, rw_node);
} else {
ctxt = kmalloc(struct_size(ctxt, rw_first_sgl, SG_CHUNK_SIZE),
GFP_KERNEL);
ctxt = kmalloc_node(struct_size(ctxt, rw_first_sgl, SG_CHUNK_SIZE),
GFP_KERNEL, ibdev_to_node(rdma->sc_cm_id->device));
if (!ctxt)
goto out_noctx;

Expand Down Expand Up @@ -234,7 +234,8 @@ svc_rdma_write_info_alloc(struct svcxprt_rdma *rdma,
{
struct svc_rdma_write_info *info;

info = kmalloc(sizeof(*info), GFP_KERNEL);
info = kmalloc_node(sizeof(*info), GFP_KERNEL,
ibdev_to_node(rdma->sc_cm_id->device));
if (!info)
return info;

Expand Down Expand Up @@ -304,7 +305,8 @@ svc_rdma_read_info_alloc(struct svcxprt_rdma *rdma)
{
struct svc_rdma_read_info *info;

info = kmalloc(sizeof(*info), GFP_KERNEL);
info = kmalloc_node(sizeof(*info), GFP_KERNEL,
ibdev_to_node(rdma->sc_cm_id->device));
if (!info)
return info;

Expand Down

0 comments on commit ac3c32b

Please sign in to comment.