Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp924322pxk; Thu, 3 Sep 2020 16:51:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZSNmsar+VRrGIFgLsKw7704UPqJQcFYsxtu+Qwd+RpEkgArI5wox2jLa6IvcVHHnQ7b+J X-Received: by 2002:a17:906:300b:: with SMTP id 11mr4678960ejz.270.1599177092817; Thu, 03 Sep 2020 16:51:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599177092; cv=none; d=google.com; s=arc-20160816; b=L9JNYZExrrBOGXEm4jw8XbwILfkDFq3C9gJ3Zx17MJh5ybE5L/QKs85JHuVSROBCfg uPPh8QePAycJ3hoGfeoq3PuRQtLQI+ppPvN7gkTub2Ij55jlgoEtsu4DJMiX3QI0305V zRZM77ICBprnsksC8EEfW9hsxPb5ullvJj5slmd/s0CWaH27eguRsgEChjA8DTPT4cQ/ ZVuDGuJwIDN5245qlcB5IPvozEG/KACffstl1K+PU2w1jErUFYvv67Pa4cYpJlCk2hwN /NldTSvi8tKdYDhEPGbKFAyclytvzxgZmH690L7MmateHdbUiY9zXC0CCcI56AF0/IKE 7sDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=U+vyB02gDnk3tEJ2VdoyrFB/nmCEZJ5qGaIzs/JXPzs=; b=UMOffThWA2BGWtEJqEqa8+h4cmhpkKHAPCLf4nQsagBWFdSP+RyjX46oLbHXOjxSDX UXUIlx6sn6Z/FAgRXp92AJGoZO67WbqtLutmzImTm9M8zCf95xKnByDl02cO6JvTJDyv ZDB20y6GQMkFHo0gJR6KH3yis27J4iqYSv/Gqi8p94XzIqkh2RqzMCxmwVuMhtUs41lX aAL9M8ETezkxZACqIj5sO+X0LRX0kjqeiFSKduuh2OrFN1wZygi59IauC2CR9dcTpU/x 6bSwxqDtAmZHGMyoKr+10308vJlFbtpKwuaDgSg9gQI2/b4xXwxipuExGUHXz/p/XpGu zhGg== ARC-Authentication-Results: i=1; mx.google.com; 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 ec22si1366226ejb.553.2020.09.03.16.51.09; Thu, 03 Sep 2020 16:51:32 -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; 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 S1728484AbgICXuj (ORCPT + 99 others); Thu, 3 Sep 2020 19:50:39 -0400 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:55969 "EHLO relay6-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725782AbgICXuh (ORCPT ); Thu, 3 Sep 2020 19:50:37 -0400 X-Originating-IP: 50.39.163.217 Received: from localhost (50-39-163-217.bvtn.or.frontiernet.net [50.39.163.217]) (Authenticated sender: josh@joshtriplett.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id ECDD6C0005; Thu, 3 Sep 2020 23:50:27 +0000 (UTC) Date: Thu, 3 Sep 2020 16:50:24 -0700 From: Josh Triplett To: Christian Brauner Cc: linux-kernel@vger.kernel.org, Christian Brauner , "Peter Zijlstra (Intel)" , Ingo Molnar , Thomas Gleixner , Oleg Nesterov , "Eric W. Biederman" , Kees Cook , Sargun Dhillon , Aleksa Sarai , linux-kselftest@vger.kernel.org, Jens Axboe , linux-api@vger.kernel.org Subject: Re: [PATCH v2 1/4] pidfd: support PIDFD_NONBLOCK in pidfd_open() Message-ID: <20200903235024.GA210207@localhost> References: <20200902102130.147672-1-christian.brauner@ubuntu.com> <20200902102130.147672-2-christian.brauner@ubuntu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200902102130.147672-2-christian.brauner@ubuntu.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 02, 2020 at 12:21:27PM +0200, Christian Brauner wrote: > Introduce PIDFD_NONBLOCK to support non-blocking pidfd file descriptors. > > Ever since the introduction of pidfds and more advanced async io various > programming languages such as Rust have grown support for async event > libraries. These libraries are created to help build epoll-based event loops > around file descriptors. A common pattern is to automatically make all file > descriptors they manage to O_NONBLOCK. > > For such libraries the EAGAIN error code is treated specially. When a function > is called that returns EAGAIN the function isn't called again until the event > loop indicates the the file descriptor is ready. Supporting EAGAIN when > waiting on pidfds makes such libraries just work with little effort. In the > following patch we will extend waitid() internally to support non-blocking > pidfds. > > This introduces a new flag PIDFD_NONBLOCK that is equivalent to O_NONBLOCK. > This follows the same patterns we have for other (anon inode) file descriptors > such as EFD_NONBLOCK, IN_NONBLOCK, SFD_NONBLOCK, TFD_NONBLOCK and the same for > close-on-exec flags. > > Link: https://lore.kernel.org/lkml/20200811181236.GA18763@localhost/ > Link: https://github.com/joshtriplett/async-pidfd > Cc: Kees Cook > Cc: Sargun Dhillon > Cc: Oleg Nesterov > Suggested-by: Josh Triplett > Signed-off-by: Christian Brauner Reviewed-by: Josh Triplett