Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4660197pxu; Tue, 13 Oct 2020 04:12:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEaFu2zlF3Hy32yfNyj47EpuEIoAnlX4+FRwq2Er1zW99b5FRCIG9VYzujD2WMxoofc3aD X-Received: by 2002:a17:906:1955:: with SMTP id b21mr33949562eje.42.1602587565704; Tue, 13 Oct 2020 04:12:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602587565; cv=none; d=google.com; s=arc-20160816; b=Gv9RKDGNa7edLBb/N3EJXSZOauyFEpr7G7YDOnOyQ88JJ8LzdsUkf6HATZvJo82uOi Sab+wrBLqAg6ZmBEgC9sjS2YSJuZQkg9ytik8DduCbYfGWxV8RHsDkhOvRn53hRLGZ33 beBLJAtbRQf1NjWXnOahbjFBIHPAv0hpDdKO6dVqmu+krVWyTw/c8oShcXCBCzRhK4ze tCKiu+1uMI0Bpp26ULp0I+qqYWmik8gUAKdEcvgABXyyK6eJXjUJ5af5GtagGLriNAqd aL4BYV+G3GVxcaQRYVeIB09B9ImjAr87dX+vBLQPJ60vV2/jYxn67LocIgo5Lwhq9zlE W3Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=W9fvtl91ZorkZ0ga43XiISUsMGGK9PX5WUdwgTBh2vI=; b=KOGiC35nXtJBQMV6TAPYSutk10RcdB/5fzzcO55ZYQMyHzaHWtjYqO1ZdSRc4ZPSOI N60QYHaMWlRdr2LP5bP2f737sUXaHNjtlHz2XNRTGTkg7jN58dj9LIhuoeK+YNtrUXfj GgeRG1nrPTgfzFlU+CdmjaJt98C6GJhNK+fAv4c8/349wfy4Q3Is22NqyutQmutMishd BmIEdj/RLY+2qDG7selwrsAmai4r3L3kg9jj3opE5jh0GLNK7z6u8m8ZIBkUJ5DMuS/x 3xRsJS/7/jHzg3vS1mm29oDjVvnXJMVfwMHk6qfIFTK+pwxGjwZKoKlzlTulW5hKcRlY av2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Dvsb9R0u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a2si13924634edr.352.2020.10.13.04.12.23; Tue, 13 Oct 2020 04:12:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Dvsb9R0u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389367AbgJLWa3 (ORCPT + 99 others); Mon, 12 Oct 2020 18:30:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389104AbgJLWa2 (ORCPT ); Mon, 12 Oct 2020 18:30:28 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 514ADC0613D0 for ; Mon, 12 Oct 2020 15:30:28 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id c21so18347665ljn.13 for ; Mon, 12 Oct 2020 15:30:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=W9fvtl91ZorkZ0ga43XiISUsMGGK9PX5WUdwgTBh2vI=; b=Dvsb9R0uvANssCFhhDBM8ZUmMAdSRxV3jfJaAInjGEfCygFxKMbDlIV5j3pIUgg7Eu pE0AugZZMK7tqUgIPTLrRumLZSaWLINCODduTowGk1mNEDDJy0MRKRHtEJ/CuEv9FAL4 PnvpkXXvZCKgBueBM/D99kpwIRoDd7FViwD+U= 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:content-transfer-encoding; bh=W9fvtl91ZorkZ0ga43XiISUsMGGK9PX5WUdwgTBh2vI=; b=eYRbR5OMzTbZ1wo3fxI4GItDfDMo1PwVeTQWkYNj9e/RdrE004zlfKJD2YbM89D6ql Z4U24xm4LopoQAv7OaIRYsENJpUIOh7WWlVc1FF29hqVpF5MxqGmTTex8l/ByrbbQSgs i2uXZaEeCrWrEl9BDLmdCu/d9RTSvWGr/RWg8bgXeCvrFJYAxTbafbBuu0LdCdOL7Ed5 Wfd2RM6YzzQw3hhZUPvNATHKspKRTZPGATmziY4p1DnWbG5jpZ2hn8nyPGdKf/oW8an2 QXx/7XbfrHT2qj09t6RTS2Era48UesP7TyPfu2p7ZHUE1A8jyNKyx3ion+1lVEn+rPlM U+qQ== X-Gm-Message-State: AOAM532YM1F7HKra8skxZbH/3upAB2+E24oUq319Nv+p34D9C6p/m+Cc x2EK9mxGZ6uIXaDkVyTnYcG8DHZHm6rVHw== X-Received: by 2002:a2e:4e01:: with SMTP id c1mr10612143ljb.144.1602541826220; Mon, 12 Oct 2020 15:30:26 -0700 (PDT) Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com. [209.85.208.169]) by smtp.gmail.com with ESMTPSA id p10sm3721619lfc.217.2020.10.12.15.30.24 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Oct 2020 15:30:25 -0700 (PDT) Received: by mail-lj1-f169.google.com with SMTP id f29so4522344ljo.3 for ; Mon, 12 Oct 2020 15:30:24 -0700 (PDT) X-Received: by 2002:a2e:9152:: with SMTP id q18mr10367236ljg.421.1602541824540; Mon, 12 Oct 2020 15:30:24 -0700 (PDT) MIME-Version: 1.0 References: <81229415-fb97-51f7-332c-d5e468bcbf2a@gmail.com> In-Reply-To: <81229415-fb97-51f7-332c-d5e468bcbf2a@gmail.com> From: Linus Torvalds Date: Mon, 12 Oct 2020 15:30:08 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Regression: epoll edge-triggered (EPOLLET) for pipes/FIFOs To: "Michael Kerrisk (man-pages)" Cc: Alexander Viro , David Howells , Rasmus Villemoes , Greg Kroah-Hartman , Peter Zijlstra , Nicolas Dichtel , Ian Kent , Christian Brauner , keyrings@vger.kernel.org, "linux-fsdevel@vger.kernel.org" , Linux API , lkml , Davide Libenzi Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 12, 2020 at 1:30 PM Michael Kerrisk (man-pages) wrote: > > I don't think this is correct. The epoll(7) manual page > sill carries the text written long ago by Davide Libenzi, > the creator of epoll: > > Since even with edge-triggered epoll, multiple events can be gen=E2= =80=90 > erated upon receipt of multiple chunks of data, the caller has the > option to specify the EPOLLONESHOT flag, to tell epoll to disable > the associated file descriptor after the receipt of an event with > epoll_wait(2). Hmm. The more I read that paragraph, the more I think the epoll man-page really talks about something that _could_ happen due to internal implementation details, but that isn't really something an epoll user would _want_ to happen or depend on. IOW, in that whole "even with edge-triggered epoll, multiple events can be generated", I'd emphasize the *can* part (as in "might", not as in "will"), and my reading is that the reason EPOLLONESHOT flag exists is to avoid that whole "this is implementation-defined, and if you absolutely _must_ get just a single event, you need to use EPOLLONESHOT to make sure you remove yourself after you got the one single event you waited for". The corollary of that reading is that the new pipe behavior is actually the _expected_ one, and the old pipe behavior where we would generate multiple events is the unwanted implementation detail of "this might still happen, and if you care, you will need to do extra stuff". Anyway, I don't absolutely hate that patch of mine, but it does seem nonsensical and pointless, and I think I'll just hold off on applying it until we hear of something actually breaking. Which I suspect simply won't happen. Getting two epoll notifications when the pipe state didn't really change in between is not something I can see anybody really depending on. You _will_ get the second notification if somebody actually emptied the pipe in between, and you have a real new "edge". But hey, I am continually surprised by what user space code then occasionally does, despite my fairly low expectations. Linus