diff options
author | Amar Tumballi <amarts@redhat.com> | 2019-01-02 18:20:07 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2019-01-09 02:53:27 +0000 |
commit | d54f5cdfbca7af2da2139fb76af1f1e416a6d848 (patch) | |
tree | 7515730d4a00adaf28efce012777ccf4376a811d /contrib | |
parent | aa28fe32364e39981981d18c784e7f396d56153f (diff) |
timer-wheel: run the timer function outside of locked region
Surprizingly this also reduced 80% CPU overhead 'perf record' tool reported
in posix_spin_lock in a brick-mux test volume initialization process.
updates: bz#1193929
Change-Id: I4e1df60d6fd094105c312df39f1527d3f07bed68
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/timer-wheel/timer-wheel.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/contrib/timer-wheel/timer-wheel.c b/contrib/timer-wheel/timer-wheel.c index cfbd74e166f..58e0607bf0c 100644 --- a/contrib/timer-wheel/timer-wheel.c +++ b/contrib/timer-wheel/timer-wheel.c @@ -159,7 +159,14 @@ run_timers (struct tvec_base *base) data = timer->data; __gf_tw_detach_timer (timer); - fn (timer, data, call_time); + pthread_spin_unlock(&base->lock); + { + /* It is required to run the actual function outside + of the locked zone, so we don't bother about + locked operations inside that function */ + fn(timer, data, call_time); + } + pthread_spin_lock(&base->lock); } } pthread_spin_unlock (&base->lock); |