aboutsummaryrefslogtreecommitdiff
path: root/time/tzset.c
diff options
context:
space:
mode:
authorKevin Easton <kevin@guarana.org>2015-02-24 23:57:07 -0500
committerMike Frysinger <vapier@gentoo.org>2015-02-24 23:58:59 -0500
commit6807b1db8233ed84671f061b5d825622233df303 (patch)
treebb908172e2818cf53b090c206b213c9d0cb652d2 /time/tzset.c
parentb433df00ae7b72053b2aac5bea1ded269ea92589 (diff)
downloadglibc-6807b1db8233ed84671f061b5d825622233df303.zip
glibc-6807b1db8233ed84671f061b5d825622233df303.tar.gz
glibc-6807b1db8233ed84671f061b5d825622233df303.tar.bz2
Reduce lock contention in __tz_convert() [BZ #16145] (partial fix)
This patch is an "easy win" partial fix for BZ #16145, which notes the heavy contention on tzset_lock when multiple threads are converting times with localtime_r(). In __tz_convert(), the lock does not need to be held after __tzfile_compute() / __tz_compute() have been called, so we can move the unlock up. At this point there is still significant work to be done in __offtime(), so we see some improvement (in my testing with 8 cores banging on localtime_r(), ~20% improvement in throughput).
Diffstat (limited to 'time/tzset.c')
-rw-r--r--time/tzset.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/time/tzset.c b/time/tzset.c
index 8bc7a2e..82324ca 100644
--- a/time/tzset.c
+++ b/time/tzset.c
@@ -644,6 +644,8 @@ __tz_convert (const time_t *timer, int use_localtime, struct tm *tp)
leap_extra_secs = 0;
}
+ __libc_lock_unlock (tzset_lock);
+
if (tp)
{
if (! use_localtime)
@@ -659,8 +661,6 @@ __tz_convert (const time_t *timer, int use_localtime, struct tm *tp)
tp = NULL;
}
- __libc_lock_unlock (tzset_lock);
-
return tp;
}