@@ -69,13 +69,15 @@ static void rpcrdma_sendctx_put_locked(struct rpcrdma_xprt *r_xprt,
6969 struct rpcrdma_sendctx * sc );
7070static int rpcrdma_reqs_setup (struct rpcrdma_xprt * r_xprt );
7171static void rpcrdma_reqs_reset (struct rpcrdma_xprt * r_xprt );
72- static void rpcrdma_rep_destroy (struct rpcrdma_rep * rep );
7372static void rpcrdma_reps_unmap (struct rpcrdma_xprt * r_xprt );
7473static void rpcrdma_mrs_create (struct rpcrdma_xprt * r_xprt );
7574static void rpcrdma_mrs_destroy (struct rpcrdma_xprt * r_xprt );
7675static void rpcrdma_ep_get (struct rpcrdma_ep * ep );
7776static int rpcrdma_ep_put (struct rpcrdma_ep * ep );
7877static struct rpcrdma_regbuf *
78+ rpcrdma_regbuf_alloc_node (size_t size , enum dma_data_direction direction ,
79+ int node );
80+ static struct rpcrdma_regbuf *
7981rpcrdma_regbuf_alloc (size_t size , enum dma_data_direction direction );
8082static void rpcrdma_regbuf_dma_unmap (struct rpcrdma_regbuf * rb );
8183static void rpcrdma_regbuf_free (struct rpcrdma_regbuf * rb );
@@ -505,7 +507,7 @@ int rpcrdma_xprt_connect(struct rpcrdma_xprt *r_xprt)
505507 * outstanding Receives.
506508 */
507509 rpcrdma_ep_get (ep );
508- rpcrdma_post_recvs (r_xprt , 1 , true );
510+ rpcrdma_post_recvs (r_xprt , 1 );
509511
510512 rc = rdma_connect (ep -> re_id , & ep -> re_remote_cma );
511513 if (rc )
@@ -938,18 +940,20 @@ static void rpcrdma_reqs_reset(struct rpcrdma_xprt *r_xprt)
938940}
939941
940942static noinline
941- struct rpcrdma_rep * rpcrdma_rep_create (struct rpcrdma_xprt * r_xprt ,
942- bool temp )
943+ struct rpcrdma_rep * rpcrdma_rep_create (struct rpcrdma_xprt * r_xprt )
943944{
944945 struct rpcrdma_buffer * buf = & r_xprt -> rx_buf ;
946+ struct rpcrdma_ep * ep = r_xprt -> rx_ep ;
947+ struct ib_device * device = ep -> re_id -> device ;
945948 struct rpcrdma_rep * rep ;
946949
947950 rep = kzalloc (sizeof (* rep ), XPRTRDMA_GFP_FLAGS );
948951 if (rep == NULL )
949952 goto out ;
950953
951- rep -> rr_rdmabuf = rpcrdma_regbuf_alloc (r_xprt -> rx_ep -> re_inline_recv ,
952- DMA_FROM_DEVICE );
954+ rep -> rr_rdmabuf = rpcrdma_regbuf_alloc_node (ep -> re_inline_recv ,
955+ DMA_FROM_DEVICE ,
956+ ibdev_to_node (device ));
953957 if (!rep -> rr_rdmabuf )
954958 goto out_free ;
955959
@@ -964,7 +968,6 @@ struct rpcrdma_rep *rpcrdma_rep_create(struct rpcrdma_xprt *r_xprt,
964968 rep -> rr_recv_wr .wr_cqe = & rep -> rr_cqe ;
965969 rep -> rr_recv_wr .sg_list = & rep -> rr_rdmabuf -> rg_iov ;
966970 rep -> rr_recv_wr .num_sge = 1 ;
967- rep -> rr_temp = temp ;
968971
969972 spin_lock (& buf -> rb_lock );
970973 list_add (& rep -> rr_all , & buf -> rb_all_reps );
@@ -983,17 +986,6 @@ static void rpcrdma_rep_free(struct rpcrdma_rep *rep)
983986 kfree (rep );
984987}
985988
986- static void rpcrdma_rep_destroy (struct rpcrdma_rep * rep )
987- {
988- struct rpcrdma_buffer * buf = & rep -> rr_rxprt -> rx_buf ;
989-
990- spin_lock (& buf -> rb_lock );
991- list_del (& rep -> rr_all );
992- spin_unlock (& buf -> rb_lock );
993-
994- rpcrdma_rep_free (rep );
995- }
996-
997989static struct rpcrdma_rep * rpcrdma_rep_get_locked (struct rpcrdma_buffer * buf )
998990{
999991 struct llist_node * node ;
@@ -1025,10 +1017,8 @@ static void rpcrdma_reps_unmap(struct rpcrdma_xprt *r_xprt)
10251017 struct rpcrdma_buffer * buf = & r_xprt -> rx_buf ;
10261018 struct rpcrdma_rep * rep ;
10271019
1028- list_for_each_entry (rep , & buf -> rb_all_reps , rr_all ) {
1020+ list_for_each_entry (rep , & buf -> rb_all_reps , rr_all )
10291021 rpcrdma_regbuf_dma_unmap (rep -> rr_rdmabuf );
1030- rep -> rr_temp = true; /* Mark this rep for destruction */
1031- }
10321022}
10331023
10341024static void rpcrdma_reps_destroy (struct rpcrdma_buffer * buf )
@@ -1245,14 +1235,15 @@ void rpcrdma_buffer_put(struct rpcrdma_buffer *buffers, struct rpcrdma_req *req)
12451235 * or Replies they may be registered externally via frwr_map.
12461236 */
12471237static struct rpcrdma_regbuf *
1248- rpcrdma_regbuf_alloc (size_t size , enum dma_data_direction direction )
1238+ rpcrdma_regbuf_alloc_node (size_t size , enum dma_data_direction direction ,
1239+ int node )
12491240{
12501241 struct rpcrdma_regbuf * rb ;
12511242
1252- rb = kmalloc (sizeof (* rb ), XPRTRDMA_GFP_FLAGS );
1243+ rb = kmalloc_node (sizeof (* rb ), XPRTRDMA_GFP_FLAGS , node );
12531244 if (!rb )
12541245 return NULL ;
1255- rb -> rg_data = kmalloc (size , XPRTRDMA_GFP_FLAGS );
1246+ rb -> rg_data = kmalloc_node (size , XPRTRDMA_GFP_FLAGS , node );
12561247 if (!rb -> rg_data ) {
12571248 kfree (rb );
12581249 return NULL ;
@@ -1264,6 +1255,12 @@ rpcrdma_regbuf_alloc(size_t size, enum dma_data_direction direction)
12641255 return rb ;
12651256}
12661257
1258+ static struct rpcrdma_regbuf *
1259+ rpcrdma_regbuf_alloc (size_t size , enum dma_data_direction direction )
1260+ {
1261+ return rpcrdma_regbuf_alloc_node (size , direction , NUMA_NO_NODE );
1262+ }
1263+
12671264/**
12681265 * rpcrdma_regbuf_realloc - re-allocate a SEND/RECV buffer
12691266 * @rb: regbuf to reallocate
@@ -1341,10 +1338,9 @@ static void rpcrdma_regbuf_free(struct rpcrdma_regbuf *rb)
13411338 * rpcrdma_post_recvs - Refill the Receive Queue
13421339 * @r_xprt: controlling transport instance
13431340 * @needed: current credit grant
1344- * @temp: mark Receive buffers to be deleted after one use
13451341 *
13461342 */
1347- void rpcrdma_post_recvs (struct rpcrdma_xprt * r_xprt , int needed , bool temp )
1343+ void rpcrdma_post_recvs (struct rpcrdma_xprt * r_xprt , int needed )
13481344{
13491345 struct rpcrdma_buffer * buf = & r_xprt -> rx_buf ;
13501346 struct rpcrdma_ep * ep = r_xprt -> rx_ep ;
@@ -1358,8 +1354,7 @@ void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, int needed, bool temp)
13581354 if (likely (ep -> re_receive_count > needed ))
13591355 goto out ;
13601356 needed -= ep -> re_receive_count ;
1361- if (!temp )
1362- needed += RPCRDMA_MAX_RECV_BATCH ;
1357+ needed += RPCRDMA_MAX_RECV_BATCH ;
13631358
13641359 if (atomic_inc_return (& ep -> re_receiving ) > 1 )
13651360 goto out_dec ;
@@ -1368,12 +1363,8 @@ void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, int needed, bool temp)
13681363 wr = NULL ;
13691364 while (needed ) {
13701365 rep = rpcrdma_rep_get_locked (buf );
1371- if (rep && rep -> rr_temp ) {
1372- rpcrdma_rep_destroy (rep );
1373- continue ;
1374- }
13751366 if (!rep )
1376- rep = rpcrdma_rep_create (r_xprt , temp );
1367+ rep = rpcrdma_rep_create (r_xprt );
13771368 if (!rep )
13781369 break ;
13791370 if (!rpcrdma_regbuf_dma_map (r_xprt , rep -> rr_rdmabuf )) {
0 commit comments