aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/iomgr
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2015-04-02 14:58:53 -0700
committerGravatar Vijay Pai <vpai@google.com>2015-04-02 14:58:53 -0700
commit74c14e5ac752edc7e1dc0aaf31abfd1153df1d0a (patch)
treede0655a9b5513c526f551f25f6cd2f27b900bdc6 /src/core/iomgr
parent7d3d9ca24c3079030b2d57c1548a9d1d32b4829b (diff)
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.
Diffstat (limited to 'src/core/iomgr')
-rw-r--r--src/core/iomgr/alarm.c4
1 files changed, 4 insertions, 0 deletions
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);