aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavidlohr Bueso <dave@stgolabs.net>2017-10-20 13:13:46 -0400
committerIngo Molnar <mingo@kernel.org>2017-10-23 07:59:21 -0400
commit88796e7e5c457cae72833196cb98e6895dd107e2 (patch)
treefc23dff02b405bca156a51176e9eb26eddfec331
parentbb176f67090ca54869fc1262c913aa69d2ede070 (diff)
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: Davidlohr Bueso <dbueso@suse.de> Acked-by: Luis 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.net Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--include/linux/swait.h27
1 files changed, 16 insertions, 11 deletions
diff --git a/include/linux/swait.h b/include/linux/swait.h
index 73e97a08d3d0..cf30f5022472 100644
--- a/include/linux/swait.h
+++ b/include/linux/swait.h
@@ -9,13 +9,16 @@
9/* 9/*
10 * Simple wait queues 10 * Simple wait queues
11 * 11 *
12 * While these are very similar to the other/complex wait queues (wait.h) the 12 * While these are very similar to regular wait queues (wait.h) the most
13 * most important difference is that the simple waitqueue allows for 13 * important difference is that the simple waitqueue allows for deterministic
14 * deterministic behaviour -- IOW it has strictly bounded IRQ and lock hold 14 * behaviour -- IOW it has strictly bounded IRQ and lock hold times.
15 * times.
16 * 15 *
17 * In order to make this so, we had to drop a fair number of features of the 16 * Mainly, this is accomplished by two things. Firstly not allowing swake_up_all
18 * other waitqueue code; notably: 17 * from IRQ disabled, and dropping the lock upon every wakeup, giving a higher
18 * priority task a chance to run.
19 *
20 * Secondly, we had to drop a fair number of features of the other waitqueue
21 * code; notably:
19 * 22 *
20 * - mixing INTERRUPTIBLE and UNINTERRUPTIBLE sleeps on the same waitqueue; 23 * - mixing INTERRUPTIBLE and UNINTERRUPTIBLE sleeps on the same waitqueue;
21 * all wakeups are TASK_NORMAL in order to avoid O(n) lookups for the right 24 * all wakeups are TASK_NORMAL in order to avoid O(n) lookups for the right
@@ -24,12 +27,14 @@
24 * - the exclusive mode; because this requires preserving the list order 27 * - the exclusive mode; because this requires preserving the list order
25 * and this is hard. 28 * and this is hard.
26 * 29 *
27 * - custom wake functions; because you cannot give any guarantees about 30 * - custom wake callback functions; because you cannot give any guarantees
28 * random code. 31 * about random code. This also allows swait to be used in RT, such that
29 * 32 * raw spinlock can be used for the swait queue head.
30 * As a side effect of this; the data structures are slimmer.
31 * 33 *
32 * One would recommend using this wait queue where possible. 34 * As a side effect of these; the data structures are slimmer albeit more ad-hoc.
35 * For all the above, note that simple wait queues should _only_ be used under
36 * very specific realtime constraints -- it is best to stick with the regular
37 * wait queues in most cases.
33 */ 38 */
34 39
35struct task_struct; 40struct task_struct;