netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Grover <andy.grover@oracle.com>
To: netdev@vger.kernel.org
Cc: rds-devel@oss.oracle.com
Subject: [PATCH 10/13] RDS: only put sockets that have seen congestion on the poll_waitq
Date: Thu, 11 Mar 2010 15:50:04 -0800	[thread overview]
Message-ID: <1268351407-7394-11-git-send-email-andy.grover@oracle.com> (raw)
In-Reply-To: <1268351407-7394-1-git-send-email-andy.grover@oracle.com>

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>
---
 net/rds/af_rds.c |    7 ++++++-
 net/rds/rds.h    |    2 ++
 net/rds/send.c   |    4 +++-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/net/rds/af_rds.c b/net/rds/af_rds.c
index 853c52b..937ecda 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,
 
 	poll_wait(file, sk->sk_sleep, wait);
 
-	poll_wait(file, &rds_poll_waitq, wait);
+	if (rs->rs_seen_congestion)
+		poll_wait(file, &rds_poll_waitq, wait);
 
 	read_lock_irqsave(&rs->rs_recv_lock, flags);
 	if (!rs->rs_cong_monitor) {
@@ -181,6 +182,10 @@ static unsigned int rds_poll(struct file *file, struct socket *sock,
 		mask |= (POLLOUT | POLLWRNORM);
 	read_unlock_irqrestore(&rs->rs_recv_lock, flags);
 
+	/* clear state any time we wake a seen-congested socket */
+	if (mask)
+		rs->rs_seen_congestion = 0;
+
 	return mask;
 }
 
diff --git a/net/rds/rds.h b/net/rds/rds.h
index 85d6f89..4bec6e2 100644
--- a/net/rds/rds.h
+++ b/net/rds/rds.h
@@ -388,6 +388,8 @@ struct rds_sock {
 
 	/* flag indicating we were congested or not */
 	int			rs_congested;
+	/* seen congestion (ENOBUFS) when sending? */
+	int			rs_seen_congestion;
 
 	/* rs_lock protects all these adjacent members before the newline */
 	spinlock_t		rs_lock;
diff --git a/net/rds/send.c b/net/rds/send.c
index 192a480..51e2def 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,
 		queue_delayed_work(rds_wq, &conn->c_conn_w, 0);
 
 	ret = rds_cong_wait(conn->c_fcong, dport, nonblock, rs);
-	if (ret)
+	if (ret) {
+		rs->rs_seen_congestion = 1;
 		goto out;
+	}
 
 	while (!rds_send_queue_rm(rs, conn, rm, rs->rs_bound_port,
 				  dport, &queued)) {
-- 
1.6.3.3


  parent reply	other threads:[~2010-03-11 23:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-11 23:49 [PATCH net-next 00/13] RDS bugfixes and cleanups Andy Grover
2010-03-11 23:49 ` [PATCH 01/13] RDS: Do not BUG() on error returned from ib_post_send Andy Grover
2010-03-11 23:49 ` [PATCH 02/13] RDS: sendmsg() should check sndtimeo, not rcvtimeo Andy Grover
2010-03-11 23:49 ` [PATCH 03/13] RDS: update copy_to_user state in tcp transport Andy Grover
2010-03-11 23:49 ` [PATCH 04/13] RDS/TCP: Wait to wake thread when write space available Andy Grover
2010-03-11 23:49 ` [PATCH 05/13] RDS: Fix congestion issues for loopback Andy Grover
2010-03-11 23:50 ` [PATCH 06/13] RDS: Fix send locking issue Andy Grover
2010-03-11 23:50 ` [PATCH 07/13] RDS: Workaround for in-use MRs on close causing crash Andy Grover
2010-03-11 23:50 ` [PATCH 08/13] RDS: Turn down alarming reconnect messages Andy Grover
2010-03-11 23:50 ` [PATCH 09/13] RDS: Fix locking in rds_send_drop_to() Andy Grover
2010-03-11 23:50 ` Andy Grover [this message]
2010-03-11 23:50 ` [PATCH 11/13] RDS: Properly unmap when getting a remote access error Andy Grover
2010-03-11 23:50 ` [PATCH 12/13] RDS: Do not call set_page_dirty() with irqs off Andy Grover
2010-03-11 23:50 ` [PATCH 13/13] RDS: Enable per-cpu workqueue threads Andy Grover
2010-03-17  4:18 ` [PATCH net-next 00/13] RDS bugfixes and cleanups David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1268351407-7394-11-git-send-email-andy.grover@oracle.com \
    --to=andy.grover@oracle.com \
    --cc=netdev@vger.kernel.org \
    --cc=rds-devel@oss.oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).