[real-time] sched_footbal atomic start: The current barrier implementation results in the lowest priority thread actually starting the game (they are the last to be scheduled to call pthread_barrier_wait). This thread likely gets a priority boost as it holds the hb->lock for the futex associated with the barrier. This might lead to it running ahead of the defense threads. In fact, any sort of barrier or cond var implementation (short of a pi aware cond broadcast, which is not yet readily available) will result in a thundering herd situation when the FUTEX_WAKE_ALL syscall is issued, which can result in a short run of one or more offense threads while all the threads get to the RUNNABLE state. This patch removes the complex starting mechansims and replaces them with a simple atomic counter. All player threads are started and once the players_ready count reaches the total player count, the referee starts the game by setting the ball position to zero. Tested on two platforms (both x86_64, 4 and 8-way) for a combined total of 13,000 iterations with 0 failures. Signed-off-by: Darren Hart <dvhltc@us.ibm.com>.
1 file changed