Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2285841yba; Fri, 19 Apr 2019 16:21:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqxWEji3np043nRSapPPz7s8Jwu0Gk16cQdFgDuicYJu1swwVvvZ2JjW/GwiYj59iFZuPyDn X-Received: by 2002:a62:b40b:: with SMTP id h11mr6475638pfn.133.1555716078142; Fri, 19 Apr 2019 16:21:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555716078; cv=none; d=google.com; s=arc-20160816; b=lIxtGkLU3LNKZ9jV4WBTFKINgPqBe05RZ5g/gOblgEpASHgCa9ed4f7ruPPIwi+bm9 mnYxrt2wA6xyPpi2Ytm+OaHzP6k/NNfL1WqaPOsN13Cxn+BVffR7W8VUKjDj5HpcsupB /es81w0ZwONpp35fcWURFPfJkuaqNOy3CZbqmCODTmOJZ8b1+vzIhaWr9jXAg0rCdFRg ZPe98TEyBKojSG51xdgQyhWKvwkZL5fEf9j9FpODEgIYedOe2yI5HQcqL5Gl5+kGfiVC 3hijJJpebgQ8yxMZ8LK88Gk8lqhHhwjrqt4sL8xseiW0NSNOdDjs3IIasLsx47tBFmXD LLLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=O7g0h4+jmBLCOEULHVApei4eYBlgtsCYwxcMsgGBV+I=; b=UijgOCaWE4E0eZ6jS3tv9/j2VL/IoXZahfKXCDseHv94neMttwFaIa0c31abFm6YDp ejGEqJlHolbyBgH4KACwNswt8pA0/QnqwtANK35uuU/PjBHuislJG49DYsO3ZOFJ3sb1 Cpx668s7yuxr/kxrAJmqLw5UDvraMpmuv0vFJBK3SS7knjWdLpNXlbpXISy66b0sOVGw JxpMzFMp8PtgdP8cMfDaXX1+LBh+SNP1TZY93i0nueecrWGCXp1dhxdZKpyj+sjR+pXl sP9uOGykfew1EK0Uo+hezGZu51pCDfJebHWNO5qkI78Pqo2WBeF5I1xWdd1L+n8cf1by UUFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brauner.io header.s=google header.b=Fh3VrPLW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q1si6934077pfb.68.2019.04.19.16.21.02; Fri, 19 Apr 2019 16:21:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@brauner.io header.s=google header.b=Fh3VrPLW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726336AbfDSXUO (ORCPT + 99 others); Fri, 19 Apr 2019 19:20:14 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:36847 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725911AbfDSXUO (ORCPT ); Fri, 19 Apr 2019 19:20:14 -0400 Received: by mail-lj1-f194.google.com with SMTP id r24so5758494ljg.3 for ; Fri, 19 Apr 2019 16:20:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brauner.io; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=O7g0h4+jmBLCOEULHVApei4eYBlgtsCYwxcMsgGBV+I=; b=Fh3VrPLWqsVMh4lZiUksE7Gfe4+PHzIpzxyzHM2jXid453jQY4l9fBdUmD756KbbRV /M8WWvdecIysntdbWTk3zMvporZkGiRp1LFZLv6iu1HGHDdJj98od7ynFTAvyTmNt20e sM2YKZOb4vfb/aECSYLhkgbdnShRzwYL8oq7P8wVbNtPnv+7fEtawlzzuu55Y47fpkgg 3e9qyloqct6JXJirMWrYFxm03WFdZ4PrPKlKO9T34Pkj/2s3OxHckU/Jb6p8Oz0r7958 g8r9iwCSsavrlwAAc1dBLxtHM7mexnKKjHIXb3h5b5gbBYS44s5FzxpUxlOxiguSl8NX pZJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=O7g0h4+jmBLCOEULHVApei4eYBlgtsCYwxcMsgGBV+I=; b=ZbKHLMtdCiKeGreilsWYszQTqgdbkhUMs9azzAr5OYBEV7uXVOuWTRzzYwE5mW/lme WtDzG21zTe6sF0MF1TKbbFkexhDsa/6U3zQH1L1pwrL49MPyTsuGjgVkGiSp4BRsB636 hVz9BRUkmSVB2Dt5bBao49BGQEaoErmZI5argbx0QdOpAZlhGsGvnHsMz72zpB3cVvki NibH29NIaviyxW2Z0VA4Ml8fzuaCph1kc4ua/FZ9ajehngOGUR2tLdb9A/vm6Xri6h+H ZimbsEXKtJ3cfiWHzAgdyORaiUxKXBFzltxtFS59lwF8JqYSRlyb9pRz/oNA/R+uya5+ Dn4g== X-Gm-Message-State: APjAAAXThBz5MIaGA04wSUD/bgQ5VX+Plm6iB9+kYLIOlWjcx2Qbcq3i aLIgzB31kVzS4NEOBTz/p+F9w0mA94SWbxy7HOcWTQ== X-Received: by 2002:a2e:7114:: with SMTP id m20mr3689144ljc.120.1555716012420; Fri, 19 Apr 2019 16:20:12 -0700 (PDT) MIME-Version: 1.0 References: <20190416120430.GA15437@redhat.com> <20190416192051.GA184889@google.com> <20190417130940.GC32622@redhat.com> <20190419190247.GB251571@google.com> <20190419191858.iwcvqm6fihbkaata@brauner.io> <20190419194902.GE251571@google.com> <20190419212002.GB44851@google.com> In-Reply-To: From: Christian Brauner Date: Sat, 20 Apr 2019 01:20:01 +0200 Message-ID: Subject: Re: [PATCH RFC 1/2] Add polling support to pidfd To: Linus Torvalds Cc: Joel Fernandes , Daniel Colascione , Jann Horn , Oleg Nesterov , Florian Weimer , kernel list , Andy Lutomirski , Steven Rostedt , Suren Baghdasaryan , Alexey Dobriyan , Al Viro , Andrei Vagin , Andrew Morton , Arnd Bergmann , "Eric W. Biederman" , Kees Cook , linux-fsdevel , "open list:KERNEL SELFTEST FRAMEWORK" , Michal Hocko , Nadav Amit , Serge Hallyn , Shuah Khan , Stephen Rothwell , Taehee Yoo , Tejun Heo , Thomas Gleixner , kernel-team , Tycho Andersen Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 20, 2019 at 1:11 AM Linus Torvalds wrote: > > On Fri, Apr 19, 2019 at 2:20 PM Joel Fernandes wrote: > > > > According to Linus, POLLHUP usually indicates that something is readable: > > Note that if you use the legacy interfaces (ie "select()"), then even > just a plain POLLHUP will always just show as "readable". > > So for a lot of applications, it won't even matter. Returning POLLHUP > will mean it's readable whether POLLIN is set or not (and EPOLLERR > will automatically mean that it's marked both readable and writable). > > In fact, I'd argue that not a lot of people care about the more > esoteric bits at all. If your poll function does POLLIN and POLLOUT, > it's fine. Anything else is specialized enough that most people simply > won't care. Don't overdesign things too much. You need to have a major > reason to care about the other POLL bits. > > It's also worth noting that POLLERR/POLLHUP/POLLNVAL cannot be masked > for "poll()". Even if you only ask for POLLIN/POLLOUT, you will always > get POLLERR/POLLHUP notification. That is again historical behavior, > and it's kind of a "you can't poll a hung up fd". But it once again > means that you should consider POLLHUP to be something *exceptional* > and final, where no further or other state changes can happen or are > relevant. Which kind of makes sense for process exit. So the historical behavior here is in our favor and having POLLIN | POLLHUP rather fitting. It just seems right that POLLHUP indicates "there can be no more state transitions". Christian