[ofa-general] [PATCH] Read all data off internal socket pipe to handle multiple wakeup requests efficiently
Davis, Arlin R
arlin.r.davis at intel.com
Sun Apr 19 00:59:54 PDT 2009
Communication to the CR thread is done using an internal socket. When a
new connection request is ready for processing, an object is placed on
the CR list, and data is written to the internal socket. The write causes
the CR thread to wake-up and process anything on its cr list.
If multiple objects are placed on the CR list around the same time, then
the CR thread will read in a single character, but process the entire list.
This results in additional data being left on the internal socket. When
the CR does a select(), it will find more data to read, read the data, but
not have any real work to do. The result is that the thread spins in a
loop checking for changes when none have occurred until all data on the
internal socket has been read.
Avoid this overhead by reading all data off the internal socket before
processing the CR list.
Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---
dapl/openib_scm/dapl_ib_cm.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/dapl/openib_scm/dapl_ib_cm.c b/dapl/openib_scm/dapl_ib_cm.c
index 6db2b4a..6af9cb2 100644
--- a/dapl/openib_scm/dapl_ib_cm.c
+++ b/dapl/openib_scm/dapl_ib_cm.c
@@ -1677,7 +1677,7 @@ void cr_thread(void *arg)
dapl_select(set);
/* if pipe used to wakeup, consume */
- if (dapl_poll(g_scm[0], DAPL_FD_READ) == DAPL_FD_READ) {
+ while (dapl_poll(g_scm[0], DAPL_FD_READ) == DAPL_FD_READ) {
if (recv(g_scm[0], rbuf, 2, 0) == -1)
dapl_log(DAPL_DBG_TYPE_CM,
" cr_thread: read pipe error = %s\n",
--
1.5.2.5
More information about the general
mailing list