[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170629190854.GE3954@linux-80c1.suse>
Date: Thu, 29 Jun 2017 12:08:54 -0700
From: Davidlohr Bueso <dave@...olabs.net>
To: "Luis R. Rodriguez" <mcgrof@...nel.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
DanielWagnerwagi@...om.org, Boqun Feng <boqun.feng@...il.com>,
Marcelo Tosatti <mtosatti@...hat.com>,
Paul Gortmaker <paul.gortmaker@...driver.com>,
Ming Lei <ming.lei@...hat.com>,
"Li, Yi" <yi1.li@...ux.intel.com>,
"AKASHI, Takahiro" <takahiro.akashi@...aro.org>,
Jakub Kicinski <jakub.kicinski@...ronome.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Petr Mladek <pmladek@...e.com>,
Andrew Lutomirski <luto@...nel.org>,
Kees Cook <keescook@...omium.org>,
David Howells <dhowells@...hat.com>,
Alan Cox <alan@...ux.intel.com>, Theodore Ts'o <tytso@....edu>,
oss-drivers@...ronome.com
Subject: Re: [PATCH] firmware: wake all waiters
On Tue, 27 Jun 2017, Luis R. Rodriguez wrote:
> * As a side effect of this; the data structures are slimmer.
> *
>- * One would recommend using this wait queue where possible.
>+ * NOTE: swait is for cases of extreme memory considerations and some very
>+ * special realtime issues, where it saves a couple of bytes in structures that
>+ * need close packing. As such its very special-use. Consider using regular
>+ * waits queues from wait.h instead *first*.
How about the following?
diff --git a/include/linux/swait.h b/include/linux/swait.h
index 4a4e180d0a35..f72f274f2a5f 100644
--- a/include/linux/swait.h
+++ b/include/linux/swait.h
@@ -9,13 +9,16 @@
/*
* Simple wait queues
*
- * While these are very similar to the other/complex wait queues (wait.h) the
- * most important difference is that the simple waitqueue allows for
- * deterministic behaviour -- IOW it has strictly bounded IRQ and lock hold
- * times.
+ * While these are very similar to regular wait queues (wait.h) the most
+ * important difference is that the simple waitqueue allows for deterministic
+ * behaviour -- IOW it has strictly bounded IRQ and lock hold times.
*
- * In order to make this so, we had to drop a fair number of features of the
- * other waitqueue code; notably:
+ * Mainly, this is accomplished by two things. Firstly not allowing swake_up_all
+ * 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;
* all wakeups are TASK_NORMAL in order to avoid O(n) lookups for the right
@@ -24,12 +27,14 @@
* - the exclusive mode; because this requires preserving the list order
* and this is hard.
*
- * - custom wake functions; because you cannot give any guarantees about
- * random code.
- *
- * As a side effect of this; the data structures are slimmer.
+ * - custom wake callback functions; because you cannot give any guarantees
+ * about random code. This also allows swait to be used in RT, such that
+ * raw spinlock can be used for the swait queue head.
*
- * 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;
Powered by blists - more mailing lists