Bug 1048731

Summary: pthread_cond_timedwait latency
Product: Red Hat Enterprise Linux 7 Reporter: wq <weiqi>
Component: glibcAssignee: Carlos O'Donell <codonell>
Status: CLOSED NOTABUG QA Contact: qe-baseos-tools-bugs
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.2CC: ashankar, codonell, fweimer, jkurik, mnewsome, pfrankli, triegel, weiqi
Target Milestone: rc   
Target Release: 7.2   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-01-11 18:27:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
the test.c for this problem none

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