Skip to content

Commit e3b267a

Browse files
author
Thananon Patinyasakdikul
committed
pml/ob1: match callback will now queue wrong sequence frag and return.
In multithreaded case, it is expensive to release the lock, call the slow match and retake the lock again just to queue the frag. This patch will eliminate number of lock taken by queueing the frag right away and return. Signed-off-by: Thananon Patinyasakdikul <[email protected]>
1 parent 4c0d347 commit e3b267a

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

ompi/mca/pml/ob1/pml_ob1_recvfrag.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,30 @@ void mca_pml_ob1_recv_frag_callback_match(mca_btl_base_module_t* btl,
164164
OB1_MATCHING_LOCK(&comm->matching_lock);
165165

166166
if (!OMPI_COMM_CHECK_ASSERT_ALLOW_OVERTAKE(comm_ptr)) {
167-
/* get sequence number of next message that can be processed */
168-
if(OPAL_UNLIKELY((((uint16_t) hdr->hdr_seq) != ((uint16_t) proc->expected_sequence)) ||
169-
(opal_list_get_size(&proc->frags_cant_match) > 0 ))) {
170-
goto slow_path;
167+
/* get sequence number of next message that can be processed.
168+
* If this frag is out of sequence, queue it up in the list
169+
* now as we still have the lock.
170+
*/
171+
if(OPAL_UNLIKELY(((uint16_t) hdr->hdr_seq) != ((uint16_t) proc->expected_sequence))) {
172+
/* We generate the MSG_ARRIVED event as soon as the PML is aware of a matching
173+
* fragment arrival. Independing if it is received on the correct order or not.
174+
* This will allow the tools to figure out if the messages are not received in the
175+
* correct order (if multiple network interfaces).
176+
*/
177+
PERUSE_TRACE_MSG_EVENT(PERUSE_COMM_MSG_ARRIVED, comm_ptr,
178+
hdr->hdr_src, hdr->hdr_tag, PERUSE_RECV);
179+
180+
append_frag_to_list(&proc->frags_cant_match, btl,
181+
hdr, segments, num_segments, NULL);
182+
OB1_MATCHING_UNLOCK(&comm->matching_lock);
183+
return;
171184
}
172185

173186
/* This is the sequence number we were expecting, so we can try
174187
* matching it to already posted receives.
175188
*/
189+
if(opal_list_get_size(&proc->frags_cant_match) > 0)
190+
goto slow_path;
176191

177192
/* We're now expecting the next sequence number. */
178193
proc->expected_sequence++;

0 commit comments

Comments
 (0)