aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAndy Grover <andy.grover@oracle.com>2010-03-11 08:50:04 -0500
committerDavid S. Miller <davem@davemloft.net>2010-03-17 00:16:59 -0400
commitb98ba52f96e7cdb4dbe2b06bced83d95d94c9d02 (patch)
tree72e22772c6326ff554bd030bda35abcb1526249e /net
parent550a8002e4340eaf3bc333e33b59427e9c20272d (diff)
RDS: only put sockets that have seen congestion on the poll_waitq
rds_poll_waitq's listeners will be awoken if we receive a congestion notification. Bad performance may result because *all* polled sockets contend for this single lock. However, it should not be necessary to wake pollers when a congestion update arrives if they have never experienced congestion, and not putting these on the waitq will hopefully greatly reduce contention. Signed-off-by: Andy Grover <andy.grover@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/rds/af_rds.c7
-rw-r--r--net/rds/rds.h2
-rw-r--r--net/rds/send.c4
3 files changed, 11 insertions, 2 deletions
diff --git a/net/rds/af_rds.c b/net/rds/af_rds.c
index 853c52be781f..937ecda4abe7 100644
--- a/net/rds/af_rds.c
+++ b/net/rds/af_rds.c
@@ -159,7 +159,8 @@ static unsigned int rds_poll(struct file *file, struct socket *sock,
159 159
160 poll_wait(file, sk->sk_sleep, wait); 160 poll_wait(file, sk->sk_sleep, wait);
161 161
162 poll_wait(file, &rds_poll_waitq, wait); 162 if (rs->rs_seen_congestion)
163 poll_wait(file, &rds_poll_waitq, wait);
163 164
164 read_lock_irqsave(&rs->rs_recv_lock, flags); 165 read_lock_irqsave(&rs->rs_recv_lock, flags);
165 if (!rs->rs_cong_monitor) { 166 if (!rs->rs_cong_monitor) {
@@ -181,6 +182,10 @@ static unsigned int rds_poll(struct file *file, struct socket *sock,
181 mask |= (POLLOUT | POLLWRNORM); 182 mask |= (POLLOUT | POLLWRNORM);
182 read_unlock_irqrestore(&rs->rs_recv_lock, flags); 183 read_unlock_irqrestore(&rs->rs_recv_lock, flags);
183 184
185 /* clear state any time we wake a seen-congested socket */
186 if (mask)
187 rs->rs_seen_congestion = 0;
188
184 return mask; 189 return mask;
185} 190}
186 191
diff --git a/net/rds/rds.h b/net/rds/rds.h
index 85d6f897ecc7..4bec6e2ed495 100644
--- a/net/rds/rds.h
+++ b/net/rds/rds.h
@@ -388,6 +388,8 @@ struct rds_sock {
388 388
389 /* flag indicating we were congested or not */ 389 /* flag indicating we were congested or not */
390 int rs_congested; 390 int rs_congested;
391 /* seen congestion (ENOBUFS) when sending? */
392 int rs_seen_congestion;
391 393
392 /* rs_lock protects all these adjacent members before the newline */ 394 /* rs_lock protects all these adjacent members before the newline */
393 spinlock_t rs_lock; 395 spinlock_t rs_lock;
diff --git a/net/rds/send.c b/net/rds/send.c
index 192a480076d0..51e2def50b12 100644
--- a/net/rds/send.c
+++ b/net/rds/send.c
@@ -894,8 +894,10 @@ int rds_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
894 queue_delayed_work(rds_wq, &conn->c_conn_w, 0); 894 queue_delayed_work(rds_wq, &conn->c_conn_w, 0);
895 895
896 ret = rds_cong_wait(conn->c_fcong, dport, nonblock, rs); 896 ret = rds_cong_wait(conn->c_fcong, dport, nonblock, rs);
897 if (ret) 897 if (ret) {
898 rs->rs_seen_congestion = 1;
898 goto out; 899 goto out;
900 }
899 901
900 while (!rds_send_queue_rm(rs, conn, rm, rs->rs_bound_port, 902 while (!rds_send_queue_rm(rs, conn, rm, rs->rs_bound_port,
901 dport, &queued)) { 903 dport, &queued)) {