Skip to content

Commit 88796e7

Browse files
Davidlohr Buesoingomolnar
authored andcommitted
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>
1 parent bb176f6 commit 88796e7

1 file changed

Lines changed: 16 additions & 11 deletions

File tree

‎include/linux/swait.h‎

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@
99
/*
1010
* Simple wait queues
1111
*
12-
* While these are very similar to the other/complex wait queues (wait.h) the
13-
* most important difference is that the simple waitqueue allows for
14-
* deterministic behaviour -- IOW it has strictly bounded IRQ and lock hold
15-
* times.
12+
* While these are very similar to regular wait queues (wait.h) the most
13+
* important difference is that the simple waitqueue allows for deterministic
14+
* behaviour -- IOW it has strictly bounded IRQ and lock hold times.
1615
*
17-
* In order to make this so, we had to drop a fair number of features of the
18-
* other waitqueue code; notably:
16+
* Mainly, this is accomplished by two things. Firstly not allowing swake_up_all
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:
1922
*
2023
* - mixing INTERRUPTIBLE and UNINTERRUPTIBLE sleeps on the same waitqueue;
2124
* all wakeups are TASK_NORMAL in order to avoid O(n) lookups for the right
@@ -24,12 +27,14 @@
2427
* - the exclusive mode; because this requires preserving the list order
2528
* and this is hard.
2629
*
27-
* - custom wake functions; because you cannot give any guarantees about
28-
* random code.
29-
*
30-
* As a side effect of this; the data structures are slimmer.
30+
* - custom wake callback functions; because you cannot give any guarantees
31+
* about random code. This also allows swait to be used in RT, such that
32+
* raw spinlock can be used for the swait queue head.
3133
*
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.
3338
*/
3439

3540
struct task_struct;

0 commit comments

Comments
 (0)