From f5e86d28f803162ffdf94b41ec7435dec92f728d Mon Sep 17 00:00:00 2001 From: Sean Hefty Date: Thu, 16 Apr 2009 10:21:26 -0700 Subject: [PATCH] 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 --- dapl/openib_scm/dapl_ib_cm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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", -- 2.46.0