From 74ade8b1813d0cbd4d4fc99d8a391ebe94f585b9 Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Mon, 30 Apr 2012 23:06:00 +0000 Subject: [PATCH] need to order the pending list before we restart This commit was SVN r26365. --- ompi/mca/mtl/portals4/mtl_portals4_flowctl.c | 28 +++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/ompi/mca/mtl/portals4/mtl_portals4_flowctl.c b/ompi/mca/mtl/portals4/mtl_portals4_flowctl.c index eedead75fc..47a8fa002d 100644 --- a/ompi/mca/mtl/portals4/mtl_portals4_flowctl.c +++ b/ompi/mca/mtl/portals4/mtl_portals4_flowctl.c @@ -283,6 +283,23 @@ ompi_mtl_portals4_flowctl_trigger(void) } +static int +seqnum_compare(opal_list_item_t **ap, opal_list_item_t **bp) +{ + ompi_mtl_portals4_pending_request_t *a = + (ompi_mtl_portals4_pending_request_t*) *ap; + ompi_mtl_portals4_pending_request_t *b = + (ompi_mtl_portals4_pending_request_t*) *bp; + + if (a->ptl_request->opcount > b->ptl_request->opcount) { + return 1; + } else if (a->ptl_request->opcount == b->ptl_request->opcount) { + return 0; + } else { + return -1; + } +} + static int start_recover(void) { @@ -329,7 +346,16 @@ start_recover(void) __FILE__, __LINE__, ret); } - /* drain event queue */ + /* reorder the pending sends by operation count */ + ret = opal_list_sort(&ompi_mtl_portals4.flowctl.pending_sends, seqnum_compare); + if (OMPI_SUCCESS != ret) { + opal_output_verbose(1, ompi_mtl_base_output, + "%s:%d opal_list_sort failed: %d\n", + __FILE__, __LINE__, ret); + return ret; + } + + /* drain event queue again, just to make sure */ while (0 != ompi_mtl_portals4_progress()) { ; } /* send barrier entry message */