Joel, Joel Fernandes <joel@xxxxxxxxxxxxxxxxx> writes: > On Wed, Mar 18, 2020 at 09:43:13PM +0100, Thomas Gleixner wrote: >> The spinlock in the wait queue head cannot be replaced by a raw_spinlock >> because: >> >> - wait queues can have custom wakeup callbacks, which acquire other >> spinlock_t locks and have potentially long execution times > > Cool, makes sense. > >> - wake_up() walks an unbounded number of list entries during the wake up >> and may wake an unbounded number of waiters. > > Just to clarify here, wake_up() will really wake up just 1 waiter if all the > waiters on the queue are exclusive right? So in such scenario at least, the > "unbounded number of waiters" would not be an issue if everything waiting was > exclusive and waitqueue with wake_up() was used. Please correct me if I'm > wrong about that though. Correct. > So the main reasons to avoid waitqueue in favor of swait (as you mentioned) > would be the sleep-while-atomic issue in truly atomic context on RT, and the > fact that callbacks can take a long time. Yes. Thanks, tglx