]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
RDS/TCP: Wait to wake thread when write space available
authorAndy Grover <andy.grover@oracle.com>
Tue, 5 Jan 2010 05:25:53 +0000 (21:25 -0800)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Tue, 7 Jul 2015 23:41:20 +0000 (16:41 -0700)
Instead of waking the send thread whenever any send space is available,
wait until it is at least half empty. This is modeled on how
sock_def_write_space() does it, and may help to minimize context
switches.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
net/rds/tcp_send.c

index ab545e0cd5d6a78da08481139158f6e87231a255..f9ee3ce087c16aad70e2d4c99f59b8cb22f79cba 100644 (file)
@@ -240,7 +240,9 @@ void rds_tcp_write_space(struct sock *sk)
        tc->t_last_seen_una = rds_tcp_snd_una(tc);
        rds_send_drop_acked(conn, rds_tcp_snd_una(tc), rds_tcp_is_acked);
 
-       queue_delayed_work(rds_wq, &conn->c_send_w, 0);
+        if ((atomic_read(&sk->sk_wmem_alloc) << 1) <= sk->sk_sndbuf)
+               queue_delayed_work(rds_wq, &conn->c_send_w, 0);
+
 out:
        read_unlock(&sk->sk_callback_lock);