Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1678099

Re: [PATCH] firmware: wake all waiters

From Davidlohr Bueso <dave@stgolabs.net>
Newsgroups linux.kernel
Subject Re: [PATCH] firmware: wake all waiters
Date 2017-06-29 21:10 +0200
Message-ID <tXMZe-354-65@gated-at.bofh.it> (permalink)
References <tVGlc-9V-17@gated-at.bofh.it> <tWK3n-7Ki-5@gated-at.bofh.it> <tWLLQ-wL-9@gated-at.bofh.it> <tWLVv-AA-5@gated-at.bofh.it> <tWMoy-10J-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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;

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] firmware: wake all waiters Jakub Kicinski <jakub.kicinski@netronome.com> - 2017-06-24 01:40 +0200
  Re: [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-26 23:30 +0200
    Re: [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-27 01:50 +0200
    Re: [PATCH] firmware: wake all waiters Jakub Kicinski <jakub.kicinski@netronome.com> - 2017-06-27 04:20 +0200
      Re: [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-27 18:40 +0200
        Re: [PATCH] firmware: wake all waiters Jakub Kicinski <jakub.kicinski@netronome.com> - 2017-06-27 23:30 +0200
          Re: [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-28 00:30 +0200
            Re: [PATCH] firmware: wake all waiters Jakub Kicinski <jakub.kicinski@netronome.com> - 2017-06-28 00:50 +0200
              Re: [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-28 02:00 +0200
            Re: [systemd-devel] [PATCH] firmware: wake all waiters Lennart Poettering <mzxreary@0pointer.de> - 2017-06-28 09:10 +0200
              Re: [systemd-devel] [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-28 18:10 +0200
                Re: [systemd-devel] [PATCH] firmware: wake all waiters Lennart Poettering <mzxreary@0pointer.de> - 2017-06-28 20:00 +0200
                Re: [systemd-devel] [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-28 20:00 +0200
                Re: [systemd-devel] [PATCH] firmware: wake all waiters Daniel Wagner <wagi@monom.org> - 2017-06-29 22:10 +0200
      Re: [PATCH] firmware: wake all waiters Bjorn Andersson <bjorn.andersson@linaro.org> - 2017-06-27 20:00 +0200
        Re: [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-27 20:10 +0200
          Re: [PATCH] firmware: wake all waiters Bjorn Andersson <bjorn.andersson@linaro.org> - 2017-06-27 21:00 +0200
            Re: [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-27 21:10 +0200
              Re: [PATCH] firmware: wake all waiters Bjorn Andersson <bjorn.andersson@linaro.org> - 2017-06-27 22:00 +0200
                Re: [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-27 22:30 +0200
  Re: [PATCH] firmware: wake all waiters Linus Torvalds <torvalds@linux-foundation.org> - 2017-06-26 23:50 +0200
    Re: [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-27 01:40 +0200
      Re: [PATCH] firmware: wake all waiters Linus Torvalds <torvalds@linux-foundation.org> - 2017-06-27 01:50 +0200
        Re: [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-27 02:20 +0200
          Re: [PATCH] firmware: wake all waiters Davidlohr Bueso <dave@stgolabs.net> - 2017-06-28 15:50 +0200
            Re: [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-28 18:00 +0200
              Re: [PATCH] firmware: wake all waiters Davidlohr Bueso <dave@stgolabs.net> - 2017-06-28 21:10 +0200
          Re: [PATCH] firmware: wake all waiters Davidlohr Bueso <dave@stgolabs.net> - 2017-06-29 21:10 +0200
            Re: [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-29 21:50 +0200
              Re: [PATCH] firmware: wake all waiters Davidlohr Bueso <dave@stgolabs.net> - 2017-06-30 18:40 +0200

csiph-web