On Thu, Nov 19, 2009 at 03:13:40PM -0800, Darren Hart wrote:This is not supposed to require any particular number of CPUs, so I am concerned about the hang.I'm basically 2 for 2 on each version of the futex_wait_test. I haven't seen it run to completion yet. This is on a stock Ubuntu kernel (2.6.31-15-generic) on my core duo laptop (32 bit).
How reproducible is this for you ? Do you know if the original test code I sent hanged in the same way ?
As we found out in private email conversation before, this was due to hitting
resource allocation limits while creating the threads. The patch below
(relative to your set_wait branch) should fix this.
Patch summary:
* Added FUTEX_WAIT_BITSET/FUTEX_WAKE_BITSET definitions - I do have
old enough headers that this was a problem now that you use
inline functions in futextest.h
* Changed futex_cmpxchg return type to int - I dont really like this change,
but otherwise gcc complains about the volatile keyword being ignored in
the returned function type. Feel free to ignore this if you like.
* futex_setwait_lock: changed to a more compact & faster implementation
(same algorithm but wrote the loop in a different way)
* test harness: look at pthread_create return code; if thread creation fails
then join with existing threads and exit. Also moved the before/after
barrier logic into the test harness rather than the futex_[set]wait_test
functions.