Skip to content

Commit 8ef24ba

Browse files
authored
Merge pull request #3117 from yanglimingcn/feature/rdma_polling_queue_all_messages
rdma polling mode all messages run in new bthreads
2 parents 1152b80 + 4de793f commit 8ef24ba

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

src/brpc/input_messenger.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -331,12 +331,7 @@ int InputMessenger::ProcessNewMessage(
331331
"destroyed when authentication failed";
332332
}
333333
}
334-
#if BRPC_WITH_RDMA
335-
if (!m->is_read_progressive() && !rdma::FLAGS_rdma_use_polling)
336-
#else
337-
if (!m->is_read_progressive())
338-
#endif
339-
{
334+
if (!m->is_read_progressive()) {
340335
// Transfer ownership to last_msg
341336
last_msg.reset(msg.release());
342337
} else {
@@ -346,6 +341,16 @@ int InputMessenger::ProcessNewMessage(
346341
num_bthread_created = 0;
347342
}
348343
}
344+
#if BRPC_WITH_RDMA
345+
// In RDMA polling mode, all messages must be executed in a new bthread and
346+
// not in the bthread where the polling bthread is located, because the
347+
// method for processing messages may call synchronization primitives,
348+
// causing the polling bthread to be scheduled out.
349+
if (rdma::FLAGS_rdma_use_polling) {
350+
QueueMessage(last_msg.release(), &num_bthread_created,
351+
m->_keytable_pool);
352+
}
353+
#endif
349354
if (num_bthread_created) {
350355
bthread_flush();
351356
}

0 commit comments

Comments
 (0)