Skip to content

Commit 12ac678

Browse files
Davidlohr BuesoPeter Zijlstra
authored andcommitted
sched/swait: Reword some of the main description
With both the increased use of swait and kvm no longer using it, we can reword some of the comments. While removing Linus' valid rant, I've also cared to explicitly mention that swait is very different than regular wait. In addition it is mentioned against using swait in favor of the regular flavor. Signed-off-by: Davidlohr Bueso <dbueso@suse.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20200422040739.18601-6-dave@stgolabs.net
1 parent 17c891a commit 12ac678

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

include/linux/swait.h

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,10 @@
99
#include <asm/current.h>
1010

1111
/*
12-
* BROKEN wait-queues.
13-
*
14-
* These "simple" wait-queues are broken garbage, and should never be
15-
* used. The comments below claim that they are "similar" to regular
16-
* wait-queues, but the semantics are actually completely different, and
17-
* every single user we have ever had has been buggy (or pointless).
18-
*
19-
* A "swake_up_one()" only wakes up _one_ waiter, which is not at all what
20-
* "wake_up()" does, and has led to problems. In other cases, it has
21-
* been fine, because there's only ever one waiter (kvm), but in that
22-
* case gthe whole "simple" wait-queue is just pointless to begin with,
23-
* since there is no "queue". Use "wake_up_process()" with a direct
24-
* pointer instead.
25-
*
26-
* While these are very similar to regular wait queues (wait.h) the most
27-
* important difference is that the simple waitqueue allows for deterministic
28-
* behaviour -- IOW it has strictly bounded IRQ and lock hold times.
12+
* Simple waitqueues are semantically very different to regular wait queues
13+
* (wait.h). The most important difference is that the simple waitqueue allows
14+
* for deterministic behaviour -- IOW it has strictly bounded IRQ and lock hold
15+
* times.
2916
*
3017
* Mainly, this is accomplished by two things. Firstly not allowing swake_up_all
3118
* from IRQ disabled, and dropping the lock upon every wakeup, giving a higher
@@ -39,7 +26,7 @@
3926
* sleeper state.
4027
*
4128
* - the !exclusive mode; because that leads to O(n) wakeups, everything is
42-
* exclusive.
29+
* exclusive. As such swake_up_one will only ever awake _one_ waiter.
4330
*
4431
* - custom wake callback functions; because you cannot give any guarantees
4532
* about random code. This also allows swait to be used in RT, such that

0 commit comments

Comments
 (0)