]> git.openfabrics.org - ~ardavis/dapl.git/commitdiff
Communication to the CR thread is done using an internal socket. When a
authorSean Hefty <sean.hefty@intel.com>
Thu, 16 Apr 2009 17:21:26 +0000 (10:21 -0700)
committerArlin Davis <arlin.r.davis@intel.com>
Thu, 16 Apr 2009 17:21:26 +0000 (10:21 -0700)
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@intel.com>
dapl/openib_scm/dapl_ib_cm.c

index 6db2b4ad150774a9bd77e5c1294ccddd349f7e9f..6af9cb280cdd0320832e2e3d0add5b1e4e719c3d 100644 (file)
@@ -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",