ipc/mqueue: Implement lockless pipelined wakeups
ipc/mqueue: Implement lockless pipelined wakeups

This patch moves the wakeup_process() invocation so it is not done under
the info->lock by making use of a lockless wake_q. With this change, the
waiter is woken up once it is STATE_READY and it does not need to loop
on SMP if it is still in STATE_PENDING. In the timeout case we still need
to grab the info->lock to verify the state.

This change should also avoid the introduction of preempt_disable() in -rt
which avoids a busy-loop which pools for the STATE_PENDING -> STATE_READY
change if the waiter has a higher priority compared to the waker.

Additionally, this patch micro-optimizes wq_sleep by using the cheaper
cousin of set_current_state(TASK_INTERRUPTABLE) as we will block no
matter what, thus get rid of the implied barrier.

Signed-off-by: Davidlohr Bueso <004a7ec0459a12f8239e6a658beae4a155e8573d@suse.de>
Signed-off-by: Peter Zijlstra (Intel) <3fddac958924aef220f202ca567388ddab3f14a8@infradead.org>
Acked-by: George Spelvin <ba324ca7b1c77fc20bb970d5aff6eea9377918a5@horizon.com>
Acked-by: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>
Cc: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Cc: Borislav Petkov <0691a664b24b6f15b20cd5aee64b72271db08be1@alien8.de>
Cc: Chris Mason <e2e8c5702d8ed5f565988a1cf5bb35c9ce199e5e@fb.com>
Cc: H. Peter Anvin <8a453bad9912ffe59bc0f0b8abe03df9be19379e@zytor.com>
Cc: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>
Cc: Manfred Spraul <e4eddfaff1fc5d7affa656f47ee4d83207ccac30@colorfullife.com>
Cc: Peter Zijlstra <3fddac958924aef220f202ca567388ddab3f14a8@infradead.org>
Cc: Sebastian Andrzej Siewior <265264fed90bdf8e813a354375ec16f47ebdb1c5@linutronix.de>
Cc: Steven Rostedt <43232e92d70cc7aa53504ad0397085ee47bad87f@goodmis.org>
Cc: bfcdf3e6ca6cef45543bfbb57509c92aec9a39fb@stgolabs.net
Link: 41fc79d4ad7b5a2abfbf281b5ffca23213a0cc50@stgolabs.net
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@kernel.org>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs