History

swait: strengthen language to discourage use

We already earlier discouraged people from using this interface in commit 88796e7e5c45 ("sched/swait: Document it clearly that the swait facilities are special and shouldn't be used"), but I just got a pull request with a new broken user. So make the comment *really* clear. The swait interfaces are bad, and should not be used unless you have some *very* strong reasons that include tons of hard performance numbers on just why you want to use them, and you show that you actually understand that they aren't at all like the normal wait/wakeup interfaces. So far, every single user has been suspect. The main user is KVM, which is completely pointless (there is only ever one waiter, which avoids the interface subtleties, but also means that having a queue instead of a pointer is counter-productive and certainly not an "optimization"). So make the comments much stronger. Not that anybody likely reads them anyway, but there's always some slight hope that it will cause somebody to think twice. I'd like to remove this interface entirely, but there is the theoretical possibility that it's actually the right thing to use in some situation, most likely some deep RT use.

Linus Torvalds committed 8 years ago

Commit c5e7a7e1 parent a31895a1 file · +13 −1Browse files

Unified · Split

include/linux/swait.h+13−1
@@ -8,7 +8,19 @@ · 7 unmodified lines
88 #include <asm/current.h>
99
1010 /*
11− * Simple wait queues
11+ * BROKEN wait-queues.
12+ *
13+ * These "simple" wait-queues are broken garbage, and should never be
14+ * used. The comments below claim that they are "similar" to regular
15+ * wait-queues, but the semantics are actually completely different, and
16+ * every single user we have ever had has been buggy (or pointless).
17+ *
18+ * A "swake_up()" only wakes up _one_ waiter, which is not at all what
19+ * "wake_up()" does, and has led to problems. In other cases, it has
20+ * been fine, because there's only ever one waiter (kvm), but in that
21+ * case gthe whole "simple" wait-queue is just pointless to begin with,
22+ * since there is no "queue". Use "wake_up_process()" with a direct
23+ * pointer instead.
1224 *
1325 * While these are very similar to regular wait queues (wait.h) the most
1426 * important difference is that the simple waitqueue allows for deterministic

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t