Skip to content

Commit ac3c32b

Browse files
committed
svcrdma: Clean up allocation of svc_rdma_rw_ctxt
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]>
1 parent ed51b42 commit ac3c32b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

net/sunrpc/xprtrdma/svc_rdma_rw.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ svc_rdma_get_rw_ctxt(struct svcxprt_rdma *rdma, unsigned int sges)
6262
if (node) {
6363
ctxt = llist_entry(node, struct svc_rdma_rw_ctxt, rw_node);
6464
} else {
65-
ctxt = kmalloc(struct_size(ctxt, rw_first_sgl, SG_CHUNK_SIZE),
66-
GFP_KERNEL);
65+
ctxt = kmalloc_node(struct_size(ctxt, rw_first_sgl, SG_CHUNK_SIZE),
66+
GFP_KERNEL, ibdev_to_node(rdma->sc_cm_id->device));
6767
if (!ctxt)
6868
goto out_noctx;
6969

@@ -234,7 +234,8 @@ svc_rdma_write_info_alloc(struct svcxprt_rdma *rdma,
234234
{
235235
struct svc_rdma_write_info *info;
236236

237-
info = kmalloc(sizeof(*info), GFP_KERNEL);
237+
info = kmalloc_node(sizeof(*info), GFP_KERNEL,
238+
ibdev_to_node(rdma->sc_cm_id->device));
238239
if (!info)
239240
return info;
240241

@@ -304,7 +305,8 @@ svc_rdma_read_info_alloc(struct svcxprt_rdma *rdma)
304305
{
305306
struct svc_rdma_read_info *info;
306307

307-
info = kmalloc(sizeof(*info), GFP_KERNEL);
308+
info = kmalloc_node(sizeof(*info), GFP_KERNEL,
309+
ibdev_to_node(rdma->sc_cm_id->device));
308310
if (!info)
309311
return info;
310312

0 commit comments

Comments
 (0)