Skip to content

Commit 53a713a

Browse files
Hakon-BuggeSomasundaram Krishnasamy
authored andcommitted
rds: Fix incorrect statistics counting
In rds_send_xmit() there is logic to batch the sends. However, if another thread has acquired the lock and has incremented the send_gen, it is considered a race and we yield. The code incrementing the s_send_lock_queue_raced statistics counter did not count this event correctly. This commit counts the race condition correctly. Orabug: 26847583 Signed-off-by: Håkon Bugge <[email protected]> Signed-off-by: David S. Miller <[email protected]> Reviewed-by: Knut Omang <[email protected]> Reviewed-by: Avinash Repaka <[email protected]> Acked-by: Santosh Shilimkar <[email protected]> Orabug: 27364391 (cherry picked from commit e6de6d3) cherry-pick-repo=linux-uek.git Conflicts: net/rds/send.c Signed-off-by: Gerd Rausch <[email protected]> Signed-off-by: Somasundaram Krishnasamy <[email protected]>
1 parent 63ae1b5 commit 53a713a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

net/rds/send.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,14 +495,18 @@ int rds_send_xmit(struct rds_conn_path *cp)
495495
* some work and we will skip our goto
496496
*/
497497
if (ret == 0) {
498+
bool raced;
499+
498500
smp_mb();
501+
raced = send_gen != READ_ONCE(cp->cp_send_gen);
502+
499503
if ((test_bit(0, &conn->c_map_queued) ||
500-
!list_empty(&cp->cp_send_queue)) &&
501-
send_gen == READ_ONCE(cp->cp_send_gen)) {
502-
rds_stats_inc(s_send_lock_queue_raced);
504+
!list_empty(&cp->cp_send_queue)) && !raced) {
503505
if (batch_count < send_batch_count)
504506
goto restart;
505507
queue_delayed_work(cp->cp_wq, &cp->cp_send_w, 1);
508+
} else if (raced) {
509+
rds_stats_inc(s_send_lock_queue_raced);
506510
}
507511
}
508512
out:

0 commit comments

Comments
 (0)