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>
This commit is contained in:
Amar Tumballi 2019-01-02 18:20:07 +05:30
parent aa28fe3236
commit d54f5cdfbc

View File

@ -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);