Mike Frysinger - Re: [PATCH][BZ #16145] Reduce lock contention in __tz_convert() (original) (raw)
This is the mail archive of the libc-alpha@sourceware.orgmailing list for the glibc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
- From: Mike Frysinger
- To: Kevin Easton
- Cc: libc-alpha at sourceware dot org
- Date: Tue, 24 Feb 2015 00:01:58 -0500
- Subject: Re: [PATCH][BZ #16145] Reduce lock contention in __tz_convert()
- Authentication-results: sourceware.org; auth=none
- References: <20150211133719 dot GA19495 at chicago dot guarana dot org>
On 12 Feb 2015 00:37, Kevin Easton wrote:
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).
my reading of __offtime is that it only operates on its arguments (or const global data like __mon_yday). it also looks expensive, so maybe we should hoist the remaining call outside of holding the lock ? can you see if that'd have any measurable improvement ?
... int offtime = 0; if (!__use_tzfile) offtime = __offtime (...);
__libc_lock_lock (tzset_lock); ... if (__use_tzfile) __tzfile_compute (*timer, use_localtime, &leap_correction, &leap_extra_secs, tp); else { if (!offtime) // modified this one line. tp = NULL; else __tz_compute (*timer, tp, use_localtime); leap_correction = 0L; leap_extra_secs = 0; }
__libc_lock_unlock (tzset_lock);
at any rate, this patch as-is lgtm -mike
Attachment:signature.asc
Description: Digital signature
- Follow-Ups:
- Re: [PATCH][BZ #16145] Reduce lock contention in __tz_convert()
* From: Mike Frysinger - Re: [PATCH][BZ #16145] Reduce lock contention in __tz_convert()
* From: Kevin Easton
- Re: [PATCH][BZ #16145] Reduce lock contention in __tz_convert()
- References:
- [PATCH][BZ #16145] Reduce lock contention in __tz_convert()
* From: Kevin Easton
- [PATCH][BZ #16145] Reduce lock contention in __tz_convert()
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |