This is the mail archive of the
mailing list for the glibc project.
Re: Fw: [RFC] PI aware condvars
- From: Darren Hart <dvhltc at us dot ibm dot com>
- To: Ulrich Drepper <drepper at redhat dot com>
- Cc: dino at in dot ibm dot com, libc-alpha at sources dot redhat dot com, Thomas Gleixner <tglx at linutronix dot de>
- Date: Fri, 26 Feb 2010 15:22:50 -0800
- Subject: Re: Fw: [RFC] PI aware condvars
- References: <20100222182541.GA4883@in.ibm.com> <4B836F7E.email@example.com>
Ulrich Drepper wrote:
-----BEGIN PGP SIGNED MESSAGE-----
On 02/22/2010 10:25 AM, Dinakar Guniguntala wrote:
Did you get a chance to take a look at the PI aware condvar patch.
More specifically, I would like your opinion on points 1 and 2
I don't have time now. The first look I took already put me off. It
adds lots of cost to the important code paths.And this for something
which is hardly ever used. I'll have more to say when I had a closer look.
First off, I wanted to share the testcase we use to demonstrate the hang
possible without PI aware Condvars as well as test the patch itself. It
uses dlsym to determine if the new np API exists and uses it if it can:
Now, regarding the added costs. I felt the changes to the common case
(when PI is not involved) were pretty minimal. Certainly any significant
regression there would be unacceptable. To try and measure the impact to
the common case by this patch, I prepared the testcase here:
It performs N iterations of cond_wait/cond_signal and reports how long
it took and how many cycles/second it achieved. I found I could get the
highest cycles/sec by running as SCHED_FIFO and by not bothering with
the mutex lock in the signaling thread, which I understand isn't good
practice, but is still compliant and seemed appropriate in this case.
I then built three versions of glibc 2.11.1 from git:
1) git: unmodified git sources
2) c_only: pthread_cond*.S files deleted
3) pi_condvar: same as c_only with the pi_condvar patches applied
Comparing #3 against #2 allows us to eliminate any gains #1 would have
solely from the hand written asm. 3 will eventually contain hand written
asm, but until the non-posix API is agreed upon, it doesn't make sense
to expend the effort of writing the asm code in my opinion.
I then ran 10 runs of 10M iterations each at SCHED_FIFO 1 priority on
each of the three glibcs, the results (following) suggest no significant
change in the non PI condvar performance, sitting right at ~270k (avg)
cycles/sec for each glibc.
Min: 202379.703125 us
Max: 285067.28125 us
Avg: 268823.0375 us
Min: 190936.03125 us
Max: 290366.21875 us
Avg: 269647.525 us
Min: 262115.796875 us
Max: 284592.6875 us
Avg: 271861.535938 us
This is only the cond_signal case, and doesn't account for
cond_timedwait or cond_broadcast, but I wouldn't expect those to
experience any additional impact from this patch. Are there scenarios
you can think of that are likely to suffer greater impact that are not
covered by this rather simple test case?
IBM Linux Technology Center
Real-Time Linux Team