Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b98ba52f authored by Andy Grover's avatar Andy Grover Committed by David S. Miller
Browse files

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: default avatarAndy Grover <andy.grover@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 550a8002
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -159,6 +159,7 @@ static unsigned int rds_poll(struct file *file, struct socket *sock,


	poll_wait(file, sk->sk_sleep, wait);
	poll_wait(file, sk->sk_sleep, wait);


	if (rs->rs_seen_congestion)
		poll_wait(file, &rds_poll_waitq, wait);
		poll_wait(file, &rds_poll_waitq, wait);


	read_lock_irqsave(&rs->rs_recv_lock, flags);
	read_lock_irqsave(&rs->rs_recv_lock, flags);
@@ -181,6 +182,10 @@ static unsigned int rds_poll(struct file *file, struct socket *sock,
		mask |= (POLLOUT | POLLWRNORM);
		mask |= (POLLOUT | POLLWRNORM);
	read_unlock_irqrestore(&rs->rs_recv_lock, flags);
	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;
	return mask;
}
}


+2 −0
Original line number Original line Diff line number Diff line
@@ -388,6 +388,8 @@ struct rds_sock {


	/* flag indicating we were congested or not */
	/* flag indicating we were congested or not */
	int			rs_congested;
	int			rs_congested;
	/* seen congestion (ENOBUFS) when sending? */
	int			rs_seen_congestion;


	/* rs_lock protects all these adjacent members before the newline */
	/* rs_lock protects all these adjacent members before the newline */
	spinlock_t		rs_lock;
	spinlock_t		rs_lock;
+3 −1
Original line number Original line Diff line number Diff line
@@ -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);
		queue_delayed_work(rds_wq, &conn->c_conn_w, 0);


	ret = rds_cong_wait(conn->c_fcong, dport, nonblock, rs);
	ret = rds_cong_wait(conn->c_fcong, dport, nonblock, rs);
	if (ret)
	if (ret) {
		rs->rs_seen_congestion = 1;
		goto out;
		goto out;
	}


	while (!rds_send_queue_rm(rs, conn, rm, rs->rs_bound_port,
	while (!rds_send_queue_rm(rs, conn, rm, rs->rs_bound_port,
				  dport, &queued)) {
				  dport, &queued)) {