From 74c14e5ac752edc7e1dc0aaf31abfd1153df1d0a Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Thu, 2 Apr 2015 14:58:53 -0700 Subject: Add in a racy check for min deadline in run_some_expired_alarms before attempting the trylock. This shaves the number of g_mu and g_checker_mu uses dramatically in perf test workload and all tests still pass. --- src/core/iomgr/alarm.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/core/iomgr') diff --git a/src/core/iomgr/alarm.c b/src/core/iomgr/alarm.c index 5860834de3..3b7092449a 100644 --- a/src/core/iomgr/alarm.c +++ b/src/core/iomgr/alarm.c @@ -307,6 +307,10 @@ static int run_some_expired_alarms(gpr_mu *drop_mu, gpr_timespec now, /* TODO(ctiller): verify that there are any alarms (atomically) here */ + if (gpr_time_cmp(g_shard_queue[0]->min_deadline, now) >= 0) { + return 0; + } + if (gpr_mu_trylock(&g_checker_mu)) { gpr_mu_lock(&g_mu); -- cgit v1.2.3