[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFwBF-Yct6VqbJbXF5KXd+2bu6HhX32BQ4WjZd132o2zPw@mail.gmail.com>
Date: Fri, 7 Jul 2017 15:48:07 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Davidlohr Bueso <dave@...olabs.net>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Greg KH <gregkh@...uxfoundation.org>,
"Luis R. Rodriguez" <mcgrof@...nel.org>,
Martin Fuzzey <mfuzzey@...keon.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Daniel Wagner <wagi@...om.org>,
David Woodhouse <dwmw2@...radead.org>,
jewalt@...innovations.com, "Rafa?? Mi??ecki" <rafal@...ecki.pl>,
Arend Van Spriel <arend.vanspriel@...adcom.com>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
"Li, Yi" <yi1.li@...ux.intel.com>, atull@...nel.org,
Moritz Fischer <moritz.fischer@...us.com>,
Petr Mladek <pmladek@...e.com>,
Johannes Berg <johannes.berg@...el.com>,
Emmanuel Grumbach <emmanuel.grumbach@...el.com>,
"Coelho, Luciano" <luciano.coelho@...el.com>,
Kalle Valo <kvalo@...eaurora.org>,
Andrew Lutomirski <luto@...nel.org>,
Kees Cook <keescook@...omium.org>,
"AKASHI, Takahiro" <takahiro.akashi@...aro.org>,
David Howells <dhowells@...hat.com>,
Peter Jones <pjones@...hat.com>,
Hans de Goede <hdegoede@...hat.com>,
Alan Cox <alan@...ux.intel.com>,
"Theodore Ts'o" <tytso@....edu>,
Michael Kerrisk <mtk.manpages@...il.com>,
Paul Gortmaker <paul.gortmaker@...driver.com>,
Marcelo Tosatti <mtosatti@...hat.com>,
Matthew Wilcox <mawilcox@...rosoft.com>,
Linux API <linux-api@...r.kernel.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"stable # 4 . 6" <stable@...r.kernel.org>
Subject: Re: [PATCH 2/4] swait: add the missing killable swaits
On Fri, Jul 7, 2017 at 3:27 PM, Davidlohr Bueso <dave@...olabs.net> wrote:
>
> Ok sorry, fwiw those were 80-line fixlets I thought were trivial enough
> to just fly by.
I find them annoying, because it makes it so much harder to see what
the patch actually does.
In this case, I think that more than 50% of the patch was just
whitespace changes..
> Oh indeed, this was always my intent. Going back to the patch, when
> checking DEFINE_WAIT_FUNC I clearly overlooked the ->func()
> implications, breaking all kinds of semantics. With that and the
> constraints aforementioned in the patch, I see no sane way of using
> wake_qs.
Well, very few people actually use "wake_up_all()", particularly for
any of the things that use special wake functions.
So it probably works in practice.
And then somebody starts using pollfd or something on one the things
that *do* use wake_up_all() and happens to also allow polling (or
whatever), and you get nasty crashes.
> Given that you seem to agree that the lockless version is possible as
> long as we keep semantics, this imho is another point for some form of
> simplified waitqueues.
We just really haven't had a lot of problems with the waitqueues in my
experience. Many of the historical big problems were about the whole
"exclusive vs non-exclusive" thundering herd problems, which is
actually the most complex thing about them (the callback function adds
a pointer to the wait queue, so makes it bigger, but that is very
seldom a huge issue).
Most of the things that want specific wakeups tend to be some really
low-level stuff (ie semaphores etc - both the sysvipc kind of ones and
the kernel locking kind of ones).
They are often doing their very special own things anyway. And often
the regular waitqueues actually work fine, and the biggest thing is to
use the lock within the waitqueue for the object that is being waited
on too, so that you just avoid the double locking.
So you may have hit the one or two cases where the usual wait-queues
didn't work well, but in *most* cases they work wonderfully.
Linus
Powered by blists - more mailing lists