pespin submitted this change.

View Change

Approvals: Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve laforge: Looks good to me, but someone else must approve pespin: Looks good to me, approved
stream: Avoid useless polling if tx_queue becomes empty

Before this patch, the WRITE poll flag was being left ON and waited to
be polled again by the kernel in order to disable it.
Let's spate that extra polling cycle which only creates more polling
triggers, context switches, etc.

Change-Id: I1dd2145249a7322ad95e49be588fd472f00734e1
---
M src/stream.c
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/stream.c b/src/stream.c
index 1ca4e9a..503fe3c 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -387,7 +387,12 @@
} else if (ret < msgb_length(msg)) {
LOGP(DLINP, LOGL_ERROR, "short send: %d < exp %u\n", ret, msgb_length(msg));
}
+
msgb_free(msg);
+
+ if (llist_empty(&cli->tx_queue))
+ osmo_fd_write_disable(&cli->ofd);
+
return 0;
}

@@ -1351,8 +1356,11 @@

msgb_free(msg);

- if (llist_empty(&conn->tx_queue) && (conn->flags & OSMO_STREAM_SRV_F_FLUSH_DESTROY))
- osmo_stream_srv_destroy(conn);
+ if (llist_empty(&conn->tx_queue)) {
+ osmo_fd_write_disable(&conn->ofd);
+ if (conn->flags & OSMO_STREAM_SRV_F_FLUSH_DESTROY)
+ osmo_stream_srv_destroy(conn);
+ }
}

static int osmo_stream_srv_cb(struct osmo_fd *ofd, unsigned int what)

To view, visit change 30721. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I1dd2145249a7322ad95e49be588fd472f00734e1
Gerrit-Change-Number: 30721
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>
Gerrit-MessageType: merged