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):
Steps to Reproduce:
1.gcc test.c -lpthread -lrt -o test
cond wait spend time: 0.000063058
if the abstime has already expired, it should return -ETIMEOUT immediatly, rather than do syscall "futex_wait"
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.
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.
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: