Bug 1048731 - pthread_cond_timedwait latency
Summary: pthread_cond_timedwait latency
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: glibc
Version: 7.2
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: rc
: 7.2
Assignee: Carlos O'Donell
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-06 09:28 UTC by wq
Modified: 2017-01-11 18:27 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-01-11 18:27:54 UTC
Target Upstream Version:


Attachments (Terms of Use)
the test.c for this problem (703 bytes, text/plain)
2014-01-06 09:28 UTC, wq
no flags Details

Description wq 2014-01-06 09:28:31 UTC
Created attachment 845976 [details]
the test.c for this problem

Description of problem:
pthread_cond_timedwait has 70us latency when the arg "abstime" has already expired


Version-Release number of selected component (if applicable):
RHEL6.3/RHEL6.4/RHEL7

How reproducible:
every time

Steps to Reproduce:
1.gcc test.c -lpthread -lrt -o test
2../test

Actual results:
cond wait spend time: 0.000063058

Expected results:
if the abstime has already expired, it should return -ETIMEOUT immediatly, rather than do  syscall "futex_wait"

Additional info:
   As I know, this problem only occurred in x86_64, because x86_64's pthread_cond_timedwait.S has this patch "http://repo.or.cz/w/glibc.git/commit/e88726b483a275824e852f64476087568dbae7bb", i386 do not has this patch. But in glibc-2.18 (Fedora koji) i386 use this patch too.
   I'm confused, why this improvement low my performance.

Comment 10 Florian Weimer 2016-01-26 15:08:34 UTC
If we perform the comparison in user space with a clocK_gettime vDSO call, the non-expired case will suffer.  I'm not sure if there is a way to improve performance across the board, and which case is more important.

Comment 12 Torvald Riegel 2017-01-11 18:27:54 UTC
The associated upstream bug has been closed as RESOLVED WONTFIX, so I'm closing this bug as well for the same reason (though with the resolution NOTABUG, which the upstream bug tracker doesn't offer; it is not a bug).  See this comment for more details about the reasons for this decision:
https://sourceware.org/bugzilla/show_bug.cgi?id=16410#c3


Note You need to log in before you can comment on or make changes to this bug.