Skip to content

Commit f20f18c

Browse files
chuckleveramschuma-ntap
authored andcommitted
xprtrdma: Prevent memory allocations from driving a reclaim
Many memory allocations that xprtrdma does can fail safely. Let's use this fact to avoid some potential deadlocks: Replace GFP_KERNEL with GFP flags that do not try hard to acquire memory. Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent 9c8f332 commit f20f18c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

net/sunrpc/xprtrdma/verbs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ struct rpcrdma_req *rpcrdma_req_create(struct rpcrdma_xprt *r_xprt,
811811
struct rpcrdma_buffer *buffer = &r_xprt->rx_buf;
812812
struct rpcrdma_req *req;
813813

814-
req = kzalloc(sizeof(*req), GFP_KERNEL);
814+
req = kzalloc(sizeof(*req), XPRTRDMA_GFP_FLAGS);
815815
if (req == NULL)
816816
goto out1;
817817

@@ -926,7 +926,7 @@ struct rpcrdma_rep *rpcrdma_rep_create(struct rpcrdma_xprt *r_xprt,
926926
struct rpcrdma_buffer *buf = &r_xprt->rx_buf;
927927
struct rpcrdma_rep *rep;
928928

929-
rep = kzalloc(sizeof(*rep), GFP_KERNEL);
929+
rep = kzalloc(sizeof(*rep), XPRTRDMA_GFP_FLAGS);
930930
if (rep == NULL)
931931
goto out;
932932

@@ -1236,10 +1236,10 @@ rpcrdma_regbuf_alloc(size_t size, enum dma_data_direction direction)
12361236
{
12371237
struct rpcrdma_regbuf *rb;
12381238

1239-
rb = kmalloc(sizeof(*rb), GFP_KERNEL);
1239+
rb = kmalloc(sizeof(*rb), XPRTRDMA_GFP_FLAGS);
12401240
if (!rb)
12411241
return NULL;
1242-
rb->rg_data = kmalloc(size, GFP_KERNEL);
1242+
rb->rg_data = kmalloc(size, XPRTRDMA_GFP_FLAGS);
12431243
if (!rb->rg_data) {
12441244
kfree(rb);
12451245
return NULL;

0 commit comments

Comments
 (0)