Skip to content

Commit ed51b42

Browse files
committed
svcrdma: Clean up allocation of svc_rdma_send_ctxt
The physical device's favored NUMA node ID is available when allocating a send_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]>
1 parent c5d68d2 commit ed51b42

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

net/sunrpc/xprtrdma/svc_rdma_sendto.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,17 @@ static void svc_rdma_send_cid_init(struct svcxprt_rdma *rdma,
123123
static struct svc_rdma_send_ctxt *
124124
svc_rdma_send_ctxt_alloc(struct svcxprt_rdma *rdma)
125125
{
126+
int node = ibdev_to_node(rdma->sc_cm_id->device);
126127
struct svc_rdma_send_ctxt *ctxt;
127128
dma_addr_t addr;
128129
void *buffer;
129-
size_t size;
130130
int i;
131131

132-
size = sizeof(*ctxt);
133-
size += rdma->sc_max_send_sges * sizeof(struct ib_sge);
134-
ctxt = kmalloc(size, GFP_KERNEL);
132+
ctxt = kmalloc_node(struct_size(ctxt, sc_sges, rdma->sc_max_send_sges),
133+
GFP_KERNEL, node);
135134
if (!ctxt)
136135
goto fail0;
137-
buffer = kmalloc(rdma->sc_max_req_size, GFP_KERNEL);
136+
buffer = kmalloc_node(rdma->sc_max_req_size, GFP_KERNEL, node);
138137
if (!buffer)
139138
goto fail1;
140139
addr = ib_dma_map_single(rdma->sc_pd->device, buffer,

0 commit comments

Comments
 (0)