sock/posix: No longer remove sockets from pending_recv in poll

This seems to be cleaning up the pending_recv list to account for the
missed cases in the previous patches in this series. Now that we're
correctly cleaning up the list, don't do this.

Note that if an EPOLLIN event is received but the application never does
a read/recv, the socket will remain in the pending recv list. The next
poll will get another EPOLLIN event, but the logic already handles that
case.

Additionally, left a TODO for a performance optimization.

Change-Id: I1cdde500a5c76554401a89de766d35b7a486b207
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6746
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Ben Walker 2021-03-04 16:07:21 -07:00 committed by Tomasz Zawadzki
parent 8ac5f9e924
commit b67aa514a4

View File

@ -1215,12 +1215,9 @@ posix_sock_group_impl_remove_sock(struct spdk_sock_group_impl *_group, struct sp
struct spdk_posix_sock *sock = __posix_sock(_sock);
int rc;
if (sock->recv_pipe != NULL) {
if (spdk_pipe_reader_bytes_available(sock->recv_pipe) > 0) {
TAILQ_REMOVE(&group->pending_recv, sock, link);
sock->pending_recv = false;
}
assert(sock->pending_recv == false);
if (sock->pending_recv) {
TAILQ_REMOVE(&group->pending_recv, sock, link);
sock->pending_recv = false;
}
#if defined(SPDK_EPOLL)
@ -1343,18 +1340,14 @@ posix_sock_group_impl_poll(struct spdk_sock_group_impl *_group, int max_events,
}
/* Cycle the pending_recv list so that each time we poll things aren't
* in the same order. */
* in the same order.
* TODO: This could be done with a single operation because psock points
* to the last node that needs to get cycled already. */
for (i = 0; i < num_events; i++) {
psock = __posix_sock(socks[i]);
TAILQ_REMOVE(&group->pending_recv, psock, link);
if (psock->recv_pipe == NULL || spdk_pipe_reader_bytes_available(psock->recv_pipe) == 0) {
psock->pending_recv = false;
} else {
TAILQ_INSERT_TAIL(&group->pending_recv, psock, link);
}
TAILQ_INSERT_TAIL(&group->pending_recv, psock, link);
}
return num_events;