[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.1rc3-12-g8335d6c

mysql vizuser noreply at mpich.org
Mon Feb 10 14:15:42 CST 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".

The branch, master has been updated
       via  8335d6c0ae1e3a5efc3d33b181e4fa2a17a6660d (commit)
       via  21887d384b937f4674a0d289c7957011a04dc57a (commit)
      from  784c271295a44783488fc773ca7e1a0b80386067 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/8335d6c0ae1e3a5efc3d33b181e4fa2a17a6660d

commit 8335d6c0ae1e3a5efc3d33b181e4fa2a17a6660d
Author: Pavan Balaji <balaji at mcs.anl.gov>
Date:   Mon Feb 10 10:56:04 2014 -0600

    Use MPL_large_readv in ch3:nemesis:tcp and ch3:sock.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/mpid/ch3/channels/nemesis/netmod/tcp/socksm.c b/src/mpid/ch3/channels/nemesis/netmod/tcp/socksm.c
index fae2d21..b34af09 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/tcp/socksm.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/tcp/socksm.c
@@ -606,7 +606,7 @@ static int recv_id_or_tmpvc_info(sockconn_t *const sc, int *got_sc_eof)
 	    iov[1].iov_len = pg_id_len;
 	    ++iov_cnt;
 	} 
-	CHECK_EINTR (nread, readv(sc->fd, iov, iov_cnt));
+	nread = MPL_large_readv(sc->fd, iov, iov_cnt);
         MPIU_ERR_CHKANDJUMP1(nread == -1 && errno != EAGAIN, mpi_errno, MPI_ERR_OTHER, "**read", "**read %s", MPIU_Strerror(errno));
 	MPIU_ERR_CHKANDJUMP(nread != hdr.datalen, mpi_errno, MPI_ERR_OTHER, "**read"); /* FIXME-Z1 */
 	if (pg_id_len == 0) {
@@ -666,7 +666,7 @@ static int recv_id_or_tmpvc_info(sockconn_t *const sc, int *got_sc_eof)
         iov[0].iov_base = (void *) &(sc->vc->port_name_tag);
         iov[0].iov_len = sizeof(sc->vc->port_name_tag);
 
-        CHECK_EINTR (nread, readv(sc->fd, iov, iov_cnt));
+        nread = MPL_large_readv(sc->fd, iov, iov_cnt);
         MPIU_ERR_CHKANDJUMP1(nread == -1 && errno != EAGAIN, mpi_errno, MPI_ERR_OTHER, "**read", "**read %s", MPIU_Strerror(errno));
         MPIU_ERR_CHKANDJUMP(nread != hdr.datalen, mpi_errno, MPI_ERR_OTHER, "**read"); /* FIXME-Z1 */
         sc->is_same_pg = FALSE;
@@ -1582,7 +1582,7 @@ static int MPID_nem_tcp_recv_handler(sockconn_t *const sc)
         MPIU_Assert(rreq->dev.iov_offset >= 0);
         MPIU_Assert(rreq->dev.iov_count + rreq->dev.iov_offset <= MPID_IOV_LIMIT);
 
-        CHECK_EINTR(bytes_recvd, readv(sc_fd, iov, rreq->dev.iov_count));
+        bytes_recvd = MPL_large_readv(sc_fd, iov, rreq->dev.iov_count);
         if (bytes_recvd <= 0)
         {
             if (bytes_recvd == -1 && errno == EAGAIN) /* handle this fast */
diff --git a/src/mpid/common/sock/poll/sock_immed.i b/src/mpid/common/sock/poll/sock_immed.i
index 323758d..4f87d1b 100644
--- a/src/mpid/common/sock/poll/sock_immed.i
+++ b/src/mpid/common/sock/poll/sock_immed.i
@@ -408,7 +408,7 @@ int MPIDU_Sock_readv(MPIDU_Sock_t sock, MPID_IOV * iov, int iov_n,
     do
     {
 	MPIDI_FUNC_ENTER(MPID_STATE_READV);
-	nb = readv(pollinfo->fd, iov, iov_n);
+	nb = MPL_large_readv(pollinfo->fd, iov, iov_n);
 	MPIDI_FUNC_EXIT(MPID_STATE_READV);
     }
     while (nb == -1 && errno == EINTR);
diff --git a/src/mpid/common/sock/poll/sock_wait.i b/src/mpid/common/sock/poll/sock_wait.i
index 8c1e48e..21a852a 100644
--- a/src/mpid/common/sock/poll/sock_wait.i
+++ b/src/mpid/common/sock/poll/sock_wait.i
@@ -583,7 +583,7 @@ static int MPIDU_Socki_handle_read(struct pollfd * const pollfd, struct pollinfo
 	if (pollinfo->read_iov_flag)
 	{ 
 	    MPIDI_FUNC_ENTER(MPID_STATE_READV);
-	    nb = readv(pollinfo->fd, pollinfo->read.iov.ptr + pollinfo->read.iov.offset,
+	    nb = MPL_large_readv(pollinfo->fd, pollinfo->read.iov.ptr + pollinfo->read.iov.offset,
 		       pollinfo->read.iov.count - pollinfo->read.iov.offset);
 	    MPIDI_FUNC_EXIT(MPID_STATE_READV);
 	}

http://git.mpich.org/mpich.git/commitdiff/21887d384b937f4674a0d289c7957011a04dc57a

commit 21887d384b937f4674a0d289c7957011a04dc57a
Author: Pavan Balaji <balaji at mcs.anl.gov>
Date:   Mon Feb 10 10:55:08 2014 -0600

    Added an MPL large readv call.
    
    We add an MPL large writev call, but missed the readv call.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/mpl/include/mplsock.h b/src/mpl/include/mplsock.h
index 4aae366..4759fca 100644
--- a/src/mpl/include/mplsock.h
+++ b/src/mpl/include/mplsock.h
@@ -35,6 +35,7 @@ extern "C" {
 /* *INDENT-OFF* */
 
 int MPL_large_writev(int fd, const struct iovec *iov, int iovcnt);
+int MPL_large_readv(int fd, const struct iovec *iov, int iovcnt);
 
 /* *INDENT-ON* */
 #if defined(__cplusplus)
diff --git a/src/mpl/src/mplsock.c b/src/mpl/src/mplsock.c
index 93504b8..087ebd5 100644
--- a/src/mpl/src/mplsock.c
+++ b/src/mpl/src/mplsock.c
@@ -66,4 +66,56 @@ int MPL_large_writev(int fd, const struct iovec *iov, int iovcnt)
 
     return total_size;
 }
+
+
+int MPL_large_readv(int fd, const struct iovec *iov, int iovcnt)
+{
+    ssize_t total_size, tmp;
+    struct iovec dummy;
+    int i;
+
+    /* If the total data fits into INT_MAX, directly use readv */
+    total_size = 0;
+    for (i = 0; i < iovcnt; i++)
+        total_size += iov[i].iov_len;
+
+    if (total_size <= INT_MAX) {
+        do {
+            tmp = readv(fd, iov, iovcnt);
+        } while (tmp == -1 && errno == EINTR);
+        return tmp;
+    }
+
+    /* Total data is larger than INT_MAX.  Issue readv with fewer
+     * elements, so as to not exceed INT_MAX.  In this case, doing
+     * multiple read calls, one for each iov segment is not a big
+     * deal with respect to performance. */
+
+    total_size = 0;
+    for (i = 0; i < iovcnt; i++) {
+        if (iov[i].iov_len <= INT_MAX) {
+            do {
+                tmp = readv(fd, &iov[i], 1);
+            } while (tmp == -1 && errno == EINTR);
+        }
+        else {
+            dummy.iov_base = iov[i].iov_base;
+            dummy.iov_len = INT_MAX;
+            do {
+                tmp = readv(fd, &dummy, 1);
+            } while (tmp == -1 && errno == EINTR);
+        }
+
+        if (tmp < 0)
+            return tmp;
+        else if (tmp < iov[i].iov_len) {
+            total_size += tmp;
+            return total_size;
+        }
+        else
+            total_size += tmp;
+    }
+
+    return total_size;
+}
 #endif /* MPL_HAVE_SYS_UIO_H */

-----------------------------------------------------------------------

Summary of changes:
 src/mpid/ch3/channels/nemesis/netmod/tcp/socksm.c |    6 +-
 src/mpid/common/sock/poll/sock_immed.i            |    2 +-
 src/mpid/common/sock/poll/sock_wait.i             |    2 +-
 src/mpl/include/mplsock.h                         |    1 +
 src/mpl/src/mplsock.c                             |   52 +++++++++++++++++++++
 5 files changed, 58 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list