提交 88796e7e 编写于 作者: D Davidlohr Bueso 提交者: Ingo Molnar

sched/swait: Document it clearly that the swait facilities are special and shouldn't be used

We currently welcome using swait over wait whenever possible because
it is a slimmer data structure. However, Linus has made it very clear
that he does not want this used, unless under very specific RT scenarios
(such as current users).

Update the comments before kernel hipsters start thinking swait is the
cool thing to do.
Signed-off-by: NDavidlohr Bueso <dbueso@suse.de>
Acked-by: NLuis R. Rodriguez <mcgrof@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: dave@stgolabs.net
Cc: wagi@monom.org
Link: http://lkml.kernel.org/r/20171020171346.24445-1-dave@stgolabs.netSigned-off-by: NIngo Molnar <mingo@kernel.org>
上级 bb176f67
...@@ -9,13 +9,16 @@ ...@@ -9,13 +9,16 @@
/* /*
* Simple wait queues * Simple wait queues
* *
* While these are very similar to the other/complex wait queues (wait.h) the * While these are very similar to regular wait queues (wait.h) the most
* most important difference is that the simple waitqueue allows for * important difference is that the simple waitqueue allows for deterministic
* deterministic behaviour -- IOW it has strictly bounded IRQ and lock hold * behaviour -- IOW it has strictly bounded IRQ and lock hold times.
* times.
* *
* In order to make this so, we had to drop a fair number of features of the * Mainly, this is accomplished by two things. Firstly not allowing swake_up_all
* other waitqueue code; notably: * from IRQ disabled, and dropping the lock upon every wakeup, giving a higher
* priority task a chance to run.
*
* Secondly, we had to drop a fair number of features of the other waitqueue
* code; notably:
* *
* - mixing INTERRUPTIBLE and UNINTERRUPTIBLE sleeps on the same waitqueue; * - mixing INTERRUPTIBLE and UNINTERRUPTIBLE sleeps on the same waitqueue;
* all wakeups are TASK_NORMAL in order to avoid O(n) lookups for the right * all wakeups are TASK_NORMAL in order to avoid O(n) lookups for the right
...@@ -24,12 +27,14 @@ ...@@ -24,12 +27,14 @@
* - the exclusive mode; because this requires preserving the list order * - the exclusive mode; because this requires preserving the list order
* and this is hard. * and this is hard.
* *
* - custom wake functions; because you cannot give any guarantees about * - custom wake callback functions; because you cannot give any guarantees
* random code. * about random code. This also allows swait to be used in RT, such that
* * raw spinlock can be used for the swait queue head.
* As a side effect of this; the data structures are slimmer.
* *
* One would recommend using this wait queue where possible. * As a side effect of these; the data structures are slimmer albeit more ad-hoc.
* For all the above, note that simple wait queues should _only_ be used under
* very specific realtime constraints -- it is best to stick with the regular
* wait queues in most cases.
*/ */
struct task_struct; struct task_struct;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册