Skip to content

Commit dde2689

Browse files
RDS: use c_wq for all activities on a connection
RDS connection work, send work, recv work etc events have been serialised by use of a single threaded work queue. For loopback connections, we created a separate thread but only connection work is moved on it. This actually under utilises the thread and creates un-necessary contention for send/recv work and connection work for loopback connections. We move remainder loopback work as well on the rds_local_wq which garantees serialisation as well as delinks the loopback and non loopback work(s). Orabug: 22347191 Tested-by: Michael Nowak <[email protected]> Tested-by: Rafael Alejandro Peralez <[email protected]> Tested-by: Liwen Huang <[email protected]> Tested-by: Hong Liu <[email protected]> Reviewed-by: Mukesh Kacker <[email protected]> Signed-off-by: Santosh Shilimkar <[email protected]>
1 parent b51e3bd commit dde2689

File tree

8 files changed

+21
-21
lines changed

8 files changed

+21
-21
lines changed

net/rds/cong.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ void rds_cong_queue_updates(struct rds_cong_map *map)
242242
list_for_each_entry(conn, &map->m_conn_list, c_map_item) {
243243
if (!test_and_set_bit(0, &conn->c_map_queued)) {
244244
rds_stats_inc(s_cong_update_queued);
245-
queue_delayed_work(rds_wq, &conn->c_send_w, 0);
245+
queue_delayed_work(conn->c_wq, &conn->c_send_w, 0);
246246
}
247247
}
248248

net/rds/ib_cm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ static void rds_ib_rx(struct rds_ib_connection *ic)
521521
if ((atomic_read(&rds_ibdev->srq->s_num_posted) <
522522
rds_ib_srq_hwm_refill) &&
523523
!test_and_set_bit(0, &rds_ibdev->srq->s_refill_gate))
524-
queue_delayed_work(rds_wq,
524+
queue_delayed_work(conn->c_wq,
525525
&rds_ibdev->srq->s_refill_w, 0);
526526

527527
if (ic->i_rx_poll_cq >= RDS_IB_RX_LIMIT) {

net/rds/ib_recv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ void rds_ib_recv_refill(struct rds_connection *conn, int prefill, gfp_t gfp)
703703
if (rds_conn_up(conn) &&
704704
(must_wake || (can_wait && ring_low)
705705
|| rds_ib_ring_empty(&ic->i_recv_ring))) {
706-
queue_delayed_work(rds_wq, &conn->c_recv_w, 1);
706+
queue_delayed_work(conn->c_wq, &conn->c_recv_w, 1);
707707
}
708708
if (can_wait)
709709
cond_resched();

net/rds/ib_send.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ void rds_ib_send_add_credits(struct rds_connection *conn, unsigned int credits)
464464

465465
atomic_add(IB_SET_SEND_CREDITS(credits), &ic->i_credits);
466466
if (test_and_clear_bit(RDS_LL_SEND_FULL, &conn->c_flags))
467-
queue_delayed_work(rds_wq, &conn->c_send_w, 0);
467+
queue_delayed_work(conn->c_wq, &conn->c_send_w, 0);
468468

469469
WARN_ON(IB_GET_SEND_CREDITS(credits) >= 16384);
470470

net/rds/send.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ int rds_send_xmit(struct rds_connection *conn)
495495
rds_stats_inc(s_send_lock_queue_raced);
496496
if (batch_count < send_batch_count)
497497
goto restart;
498-
queue_delayed_work(rds_wq, &conn->c_send_w, 1);
498+
queue_delayed_work(conn->c_wq, &conn->c_send_w, 1);
499499
}
500500
}
501501
out:
@@ -1401,7 +1401,7 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len)
14011401

14021402
ret = rds_send_xmit(conn);
14031403
if (ret == -ENOMEM || ret == -EAGAIN)
1404-
queue_delayed_work(rds_wq, &conn->c_send_w, 1);
1404+
queue_delayed_work(conn->c_wq, &conn->c_send_w, 1);
14051405

14061406

14071407
rds_message_put(rm);
@@ -1521,7 +1521,7 @@ int rds_send_internal(struct rds_connection *conn, struct rds_sock *rs,
15211521
rds_stats_inc(s_send_queue_full);
15221522

15231523
/* force a requeue of the work for later */
1524-
queue_delayed_work(rds_wq, &conn->c_send_w, 1);
1524+
queue_delayed_work(conn->c_wq, &conn->c_send_w, 1);
15251525

15261526
ret = -EAGAIN;
15271527
goto out;
@@ -1534,7 +1534,7 @@ int rds_send_internal(struct rds_connection *conn, struct rds_sock *rs,
15341534
rds_stats_inc(s_send_queued);
15351535

15361536
/* always hand the send off to the worker thread */
1537-
queue_delayed_work(rds_wq, &conn->c_send_w, 0);
1537+
queue_delayed_work(conn->c_wq, &conn->c_send_w, 0);
15381538

15391539
rdsdebug("message sent for rs %p, conn %p, len %d, %u.%u.%u.%u : %u -> %u.%u.%u.%u : %u\n",
15401540
rs, conn, skb->len, NIPQUAD(dst->saddr), dst->sport, NIPQUAD(dst->daddr), dst->dport);
@@ -1597,7 +1597,7 @@ rds_send_pong(struct rds_connection *conn, __be16 dport)
15971597
rds_stats_inc(s_send_pong);
15981598

15991599
if (!test_bit(RDS_LL_SEND_FULL, &conn->c_flags))
1600-
queue_delayed_work(rds_wq, &conn->c_send_w, 0);
1600+
queue_delayed_work(conn->c_wq, &conn->c_send_w, 0);
16011601

16021602
rds_message_put(rm);
16031603
return 0;
@@ -1646,7 +1646,7 @@ rds_send_hb(struct rds_connection *conn, int response)
16461646

16471647
ret = rds_send_xmit(conn);
16481648
if (ret == -ENOMEM || ret == -EAGAIN)
1649-
queue_delayed_work(rds_wq, &conn->c_send_w, 1);
1649+
queue_delayed_work(conn->c_wq, &conn->c_send_w, 1);
16501650

16511651
rds_message_put(rm);
16521652
return 0;
@@ -1671,5 +1671,5 @@ void rds_route_to_base(struct rds_connection *conn)
16711671
}
16721672
spin_unlock_irqrestore(&base_conn->c_lock, flags);
16731673
conn->c_route_to_base = 1;
1674-
queue_delayed_work(rds_wq, &base_conn->c_send_w, 0);
1674+
queue_delayed_work(conn->c_wq, &base_conn->c_send_w, 0);
16751675
}

net/rds/tcp_recv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ void rds_tcp_data_ready(struct sock *sk)
318318
rds_tcp_stats_inc(s_tcp_data_ready_calls);
319319

320320
if (rds_tcp_read_sock(conn, GFP_ATOMIC) == -ENOMEM)
321-
queue_delayed_work(rds_wq, &conn->c_recv_w, 0);
321+
queue_delayed_work(conn->c_wq, &conn->c_recv_w, 0);
322322
out:
323323
read_unlock(&sk->sk_callback_lock);
324324
ready(sk);

net/rds/tcp_send.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ void rds_tcp_write_space(struct sock *sk)
197197
rds_send_drop_acked(conn, rds_tcp_snd_una(tc), rds_tcp_is_acked);
198198

199199
if ((atomic_read(&sk->sk_wmem_alloc) << 1) <= sk->sk_sndbuf)
200-
queue_delayed_work(rds_wq, &conn->c_send_w, 0);
200+
queue_delayed_work(conn->c_wq, &conn->c_send_w, 0);
201201

202202
out:
203203
read_unlock(&sk->sk_callback_lock);

net/rds/threads.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ void rds_connect_path_complete(struct rds_connection *conn, int curr)
9494

9595
conn->c_reconnect_jiffies = 0;
9696
set_bit(0, &conn->c_map_queued);
97-
queue_delayed_work(rds_wq, &conn->c_send_w, 0);
98-
queue_delayed_work(rds_wq, &conn->c_recv_w, 0);
99-
queue_delayed_work(rds_wq, &conn->c_hb_w, 0);
97+
queue_delayed_work(conn->c_wq, &conn->c_send_w, 0);
98+
queue_delayed_work(conn->c_wq, &conn->c_recv_w, 0);
99+
queue_delayed_work(conn->c_wq, &conn->c_hb_w, 0);
100100
conn->c_hb_start = 0;
101101

102102
conn->c_connection_start = get_seconds();
@@ -211,11 +211,11 @@ void rds_send_worker(struct work_struct *work)
211211
switch (ret) {
212212
case -EAGAIN:
213213
rds_stats_inc(s_send_immediate_retry);
214-
queue_delayed_work(rds_wq, &conn->c_send_w, 0);
214+
queue_delayed_work(conn->c_wq, &conn->c_send_w, 0);
215215
break;
216216
case -ENOMEM:
217217
rds_stats_inc(s_send_delayed_retry);
218-
queue_delayed_work(rds_wq, &conn->c_send_w, 2);
218+
queue_delayed_work(conn->c_wq, &conn->c_send_w, 2);
219219
default:
220220
break;
221221
}
@@ -233,11 +233,11 @@ void rds_recv_worker(struct work_struct *work)
233233
switch (ret) {
234234
case -EAGAIN:
235235
rds_stats_inc(s_recv_immediate_retry);
236-
queue_delayed_work(rds_wq, &conn->c_recv_w, 0);
236+
queue_delayed_work(conn->c_wq, &conn->c_recv_w, 0);
237237
break;
238238
case -ENOMEM:
239239
rds_stats_inc(s_recv_delayed_retry);
240-
queue_delayed_work(rds_wq, &conn->c_recv_w, 2);
240+
queue_delayed_work(conn->c_wq, &conn->c_recv_w, 2);
241241
default:
242242
break;
243243
}
@@ -281,7 +281,7 @@ void rds_hb_worker(struct work_struct *work)
281281
rds_conn_drop(conn, DR_HB_TIMEOUT);
282282
return;
283283
}
284-
queue_delayed_work(rds_wq, &conn->c_hb_w, HZ);
284+
queue_delayed_work(conn->c_wq, &conn->c_hb_w, HZ);
285285
}
286286
}
287287

0 commit comments

Comments
 (0)