From e587a5ce97fda0c42275708d4c2ce498a8ee1345 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 6 Jun 2017 15:12:33 +0000 Subject: Fix contention detection --- src/core/lib/iomgr/combiner.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/core/lib') diff --git a/src/core/lib/iomgr/combiner.c b/src/core/lib/iomgr/combiner.c index b77a68eead..e15448f5f3 100644 --- a/src/core/lib/iomgr/combiner.c +++ b/src/core/lib/iomgr/combiner.c @@ -222,14 +222,18 @@ bool grpc_combiner_continue_exec_ctx(grpc_exec_ctx *exec_ctx) { return false; } + bool contended = gpr_atm_no_barrier_load(&lock->initiating_exec_ctx_or_null) == 0; + GRPC_COMBINER_TRACE(gpr_log(GPR_DEBUG, "C:%p grpc_combiner_continue_exec_ctx " + "contended=%d " "exec_ctx_ready_to_finish=%d " "time_to_execute_final_list=%d", - lock, grpc_exec_ctx_ready_to_finish(exec_ctx), + lock, contended, grpc_exec_ctx_ready_to_finish(exec_ctx), lock->time_to_execute_final_list)); - if (grpc_exec_ctx_ready_to_finish(exec_ctx) && grpc_executor_is_threaded()) { + if (contended && + grpc_exec_ctx_ready_to_finish(exec_ctx) && grpc_executor_is_threaded()) { GPR_TIMER_MARK("offload_from_finished_exec_ctx", 0); // this execution context wants to move on, and we have a workqueue (and // so can help the execution context out): schedule remaining work to be -- cgit v1.2.3