From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Torvalds Subject: Re: [PATCH 5/7] userfaultfd: switch to exclusive wakeup for blocking reads Date: Mon, 15 Jun 2015 08:19:07 -1000 Message-ID: References: <1434388931-24487-1-git-send-email-aarcange@redhat.com> <1434388931-24487-6-git-send-email-aarcange@redhat.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=90e6ba6e8ade5dc9700518927e7c Cc: "Huangpeng (Peter)" , Paolo Bonzini , qemu-devel@nongnu.org, Pavel Emelyanov , Hugh Dickins , Andrew Morton , "Dr. David Alan Gilbert" , Andres Lagar-Cavilla , Andy Lutomirski , linux-mm@kvack.org, Johannes Weiner , Rik van Riel , "Kirill A. Shutemov" , linux-kernel@vger.kernel.org, zhang.zhanghailiang@huawei.com, Sanidhya Kashyap , Dave Hansen , Peter Feiner , Mel Gorman , kvm@vger.kernel.org To: Andrea Arcangeli Return-path: In-Reply-To: <1434388931-24487-6-git-send-email-aarcange@redhat.com> Sender: owner-linux-mm@kvack.org List-Id: kvm.vger.kernel.org --90e6ba6e8ade5dc9700518927e7c Content-Type: text/plain; charset=UTF-8 On Jun 15, 2015 7:22 AM, "Andrea Arcangeli" wrote: > > Blocking reads can easily use exclusive wakeups. Poll in theory could > too but there's no poll_wait_exclusive in common code yet. NAK. Tie while commit message is crap, and so us the comment No, your really cannot "easily use exclusive waits", and no, using them for polling isn't about a lack of interface, it's about the fact that it would be buggy shit. What if the process doing the polling never doors anything with the end result? Maybe it meant to, but it got killed before it could? Are you going to leave everybody else blocked, even though there are pending events? The same us try of read() too. What if the reader only reads party of the message? The wake didn't wake anybody else, so now people are (again) blocked despite there being data. So no, exclusive waiting is never "simple". You have to 100% guarantee that you will consume all the data that caused the wake event (or perhaps wake the next person up if you don't). Linus --90e6ba6e8ade5dc9700518927e7c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On Jun 15, 2015 7:22 AM, "Andrea Arcangeli" <aarcange@redhat.com> wrote:
>
> Blocking reads can easily use exclusive wakeups. Poll in theory could<= br> > too but there's no poll_wait_exclusive in common code yet.

NAK.

Tie while commit message is crap, and so us the comment

No, your really cannot "easily use exclusive waits"= ;, and no, using them for polling isn't about a lack of interface, it&#= 39;s about the fact that it would be buggy shit.

What if the process doing the polling never doors anything w= ith the end result? Maybe it meant to, but it got killed before it could? A= re you going to leave everybody else blocked, even though there are pending= events?

The same us try of read() too. What if the reader only reads= party of the message? The wake didn't wake anybody else, so now people= are (again) blocked despite there being data.

So no, exclusive waiting is never "simple". You ha= ve to 100% guarantee that you will consume all the data that caused the wak= e event (or perhaps wake the next person up if you don't).

=C2=A0=C2=A0=C2=A0 Linus

--90e6ba6e8ade5dc9700518927e7c-- -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60142) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4YyU-0005ob-57 for qemu-devel@nongnu.org; Mon, 15 Jun 2015 14:19:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z4YyS-0007xl-JS for qemu-devel@nongnu.org; Mon, 15 Jun 2015 14:19:10 -0400 Received: from mail-ig0-x236.google.com ([2607:f8b0:4001:c05::236]:36770) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4YyS-0007xV-Cc for qemu-devel@nongnu.org; Mon, 15 Jun 2015 14:19:08 -0400 Received: by igbiq7 with SMTP id iq7so24846678igb.1 for ; Mon, 15 Jun 2015 11:19:08 -0700 (PDT) MIME-Version: 1.0 Sender: linus971@gmail.com In-Reply-To: <1434388931-24487-6-git-send-email-aarcange@redhat.com> References: <1434388931-24487-1-git-send-email-aarcange@redhat.com> <1434388931-24487-6-git-send-email-aarcange@redhat.com> Date: Mon, 15 Jun 2015 08:19:07 -1000 Message-ID: From: Linus Torvalds Content-Type: multipart/alternative; boundary=90e6ba6e8ade5dc9700518927e7c Subject: Re: [Qemu-devel] [PATCH 5/7] userfaultfd: switch to exclusive wakeup for blocking reads List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andrea Arcangeli Cc: Dave Hansen , zhang.zhanghailiang@huawei.com, kvm@vger.kernel.org, Pavel Emelyanov , linux-kernel@vger.kernel.org, "Kirill A. Shutemov" , Hugh Dickins , "Huangpeng (Peter)" , qemu-devel@nongnu.org, Sanidhya Kashyap , linux-mm@kvack.org, Andres Lagar-Cavilla , Mel Gorman , Johannes Weiner , Paolo Bonzini , Andrew Morton , Andy Lutomirski , "Dr. David Alan Gilbert" , Peter Feiner --90e6ba6e8ade5dc9700518927e7c Content-Type: text/plain; charset=UTF-8 On Jun 15, 2015 7:22 AM, "Andrea Arcangeli" wrote: > > Blocking reads can easily use exclusive wakeups. Poll in theory could > too but there's no poll_wait_exclusive in common code yet. NAK. Tie while commit message is crap, and so us the comment No, your really cannot "easily use exclusive waits", and no, using them for polling isn't about a lack of interface, it's about the fact that it would be buggy shit. What if the process doing the polling never doors anything with the end result? Maybe it meant to, but it got killed before it could? Are you going to leave everybody else blocked, even though there are pending events? The same us try of read() too. What if the reader only reads party of the message? The wake didn't wake anybody else, so now people are (again) blocked despite there being data. So no, exclusive waiting is never "simple". You have to 100% guarantee that you will consume all the data that caused the wake event (or perhaps wake the next person up if you don't). Linus --90e6ba6e8ade5dc9700518927e7c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On Jun 15, 2015 7:22 AM, "Andrea Arcangeli" <aarcange@redhat.com> wrote:
>
> Blocking reads can easily use exclusive wakeups. Poll in theory could<= br> > too but there's no poll_wait_exclusive in common code yet.

NAK.

Tie while commit message is crap, and so us the comment

No, your really cannot "easily use exclusive waits"= ;, and no, using them for polling isn't about a lack of interface, it&#= 39;s about the fact that it would be buggy shit.

What if the process doing the polling never doors anything w= ith the end result? Maybe it meant to, but it got killed before it could? A= re you going to leave everybody else blocked, even though there are pending= events?

The same us try of read() too. What if the reader only reads= party of the message? The wake didn't wake anybody else, so now people= are (again) blocked despite there being data.

So no, exclusive waiting is never "simple". You ha= ve to 100% guarantee that you will consume all the data that caused the wak= e event (or perhaps wake the next person up if you don't).

=C2=A0=C2=A0=C2=A0 Linus

--90e6ba6e8ade5dc9700518927e7c--