summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorHåkon Bugge <Haakon.Bugge@oracle.com>2017-09-06 18:35:51 +0200
committerDavid S. Miller <davem@davemloft.net>2017-09-07 20:07:13 -0700
commit126f760ca94dae77425695f9f9238b731de86e32 (patch)
tree9eb6678bb969d67a8f6cbab6110f0816bbde0798 /net
parenteef5a7cc2a571eb2176c8b9260d4ccfc9f6be127 (diff)
downloadlinux-126f760ca94dae77425695f9f9238b731de86e32.tar.bz2
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. Changes from v1: - Removed check for *someone_on_xmit()* - Fixed incorrect indentation Signed-off-by: Håkon Bugge <haakon.bugge@oracle.com> Reviewed-by: Knut Omang <knut.omang@oracle.com> Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/rds/send.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/net/rds/send.c b/net/rds/send.c
index 058a40743041..b52cdc8ae428 100644
--- a/net/rds/send.c
+++ b/net/rds/send.c
@@ -428,14 +428,18 @@ over_batch:
* some work and we will skip our goto
*/
if (ret == 0) {
+ bool raced;
+
smp_mb();
+ raced = send_gen != READ_ONCE(cp->cp_send_gen);
+
if ((test_bit(0, &conn->c_map_queued) ||
- !list_empty(&cp->cp_send_queue)) &&
- send_gen == READ_ONCE(cp->cp_send_gen)) {
- rds_stats_inc(s_send_lock_queue_raced);
+ !list_empty(&cp->cp_send_queue)) && !raced) {
if (batch_count < send_batch_count)
goto restart;
queue_delayed_work(rds_wq, &cp->cp_send_w, 1);
+ } else if (raced) {
+ rds_stats_inc(s_send_lock_queue_raced);
}
}
out: