linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@stgolabs.net>
To: "Luis R. Rodriguez" <mcgrof@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	DanielWagnerwagi@monom.org, Boqun Feng <boqun.feng@gmail.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Paul Gortmaker <paul.gortmaker@windriver.com>,
	Ming Lei <ming.lei@redhat.com>, "Li, Yi" <yi1.li@linux.intel.com>,
	"AKASHI, Takahiro" <takahiro.akashi@linaro.org>,
	Jakub Kicinski <jakub.kicinski@netronome.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Petr Mladek <pmladek@suse.com>,
	Andrew Lutomirski <luto@kernel.org>,
	Kees Cook <keescook@chromium.org>,
	David Howells <dhowells@redhat.com>,
	Alan Cox <alan@linux.intel.com>, "Theodore Ts'o" <tytso@mit.edu>,
	oss-drivers@netronome.com
Subject: Re: [PATCH] firmware: wake all waiters
Date: Thu, 29 Jun 2017 12:08:54 -0700	[thread overview]
Message-ID: <20170629190854.GE3954@linux-80c1.suse> (raw)
In-Reply-To: <20170627001534.GK21846@wotan.suse.de>

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;

  parent reply	other threads:[~2017-06-29 19:09 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-23 23:37 [PATCH] firmware: wake all waiters Jakub Kicinski
2017-06-26 21:20 ` Luis R. Rodriguez
2017-06-26 21:23   ` [PATCH v2] firmware: fix batched requests - " Luis R. Rodriguez
2017-06-29 15:16     ` Greg KH
2017-06-29 15:17       ` Greg KH
2017-06-29 17:36         ` Luis R. Rodriguez
2017-06-26 23:41   ` [PATCH] firmware: " Luis R. Rodriguez
2017-06-27  2:10   ` Jakub Kicinski
2017-06-27 16:39     ` Luis R. Rodriguez
2017-06-27 21:25       ` Jakub Kicinski
2017-06-27 22:24         ` Luis R. Rodriguez
2017-06-27 22:39           ` Jakub Kicinski
2017-06-27 23:50             ` Luis R. Rodriguez
2017-06-28  7:06           ` [systemd-devel] " Lennart Poettering
2017-06-28 16:06             ` Luis R. Rodriguez
2017-06-28 16:21               ` Lennart Poettering
2017-06-28 17:57                 ` Luis R. Rodriguez
2017-06-29 19:56               ` Daniel Wagner
2017-06-27 17:48     ` Bjorn Andersson
2017-06-27 18:03       ` Luis R. Rodriguez
2017-06-27 18:59         ` Bjorn Andersson
2017-06-27 19:08           ` Luis R. Rodriguez
2017-06-27 19:52             ` Bjorn Andersson
2017-06-27 20:24               ` Luis R. Rodriguez
2017-06-26 21:44 ` Linus Torvalds
2017-06-26 23:30   ` Luis R. Rodriguez
2017-06-26 23:43     ` Linus Torvalds
2017-06-27  0:15       ` Luis R. Rodriguez
2017-06-28 13:45         ` Davidlohr Bueso
2017-06-28 15:58           ` Luis R. Rodriguez
2017-06-28 19:03             ` Davidlohr Bueso
2017-06-29 19:08         ` Davidlohr Bueso [this message]
2017-06-29 19:48           ` Luis R. Rodriguez
2017-06-30 16:32             ` Davidlohr Bueso
2017-07-05 16:18     ` Peter Zijlstra
2017-07-05 16:33       ` Linus Torvalds
2017-07-12 18:45         ` Luis R. Rodriguez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170629190854.GE3954@linux-80c1.suse \
    --to=dave@stgolabs.net \
    --cc=DanielWagnerwagi@monom.org \
    --cc=alan@linux.intel.com \
    --cc=boqun.feng@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jakub.kicinski@netronome.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=oss-drivers@netronome.com \
    --cc=paul.gortmaker@windriver.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=pmladek@suse.com \
    --cc=takahiro.akashi@linaro.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    --cc=yi1.li@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).