On Thu, 29 Jun 2017, Linus Torvalds wrote:
So without some very compelling reason, I'd not want to add yet another wait-queue.
Yes, I was expecting this and very much agree. I'll actually take a look at wake_q for wake_up_all() and co. to see if we can reduce the spinlock hold times. Of course it would only make sense for more than a one wakeup.
I actually think swait is pure garbage. Most users only wake up one process anyway, and using swait for that is stupid. If you only wake up one, you might as well just have a single process pointer, not a wait list at all, and then use "wake_up_process()".
But you still need the notion of a queue, even if you wake one task at a time... I'm probably missing your point here.
There is *one* single user of swake_up_all(), and that one looks like bogus crap also: it does it outside of the spinlock that could have been used to protect the queue - p,lus I'm not sure there's really a queue anyway, since I think it's just the grace-period kthread that is there.
So those cases when there's only one waiter I completely agree should not be using waitqueues. pcpu-rwsems in the past suffered from this. Thanks, Davidlohr