From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E2E4C433E6 for ; Tue, 1 Sep 2020 16:53:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 15732206C0 for ; Tue, 1 Sep 2020 16:53:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="TcVTXNKw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730033AbgIAQxc (ORCPT ); Tue, 1 Sep 2020 12:53:32 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:60744 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732332AbgIAQx1 (ORCPT ); Tue, 1 Sep 2020 12:53:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598979206; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=avbleNGUb+J89GYGqB+uFJ1WJDboHCvs4T7vUTWniQ8=; b=TcVTXNKwvy8WXucWGP4mJkUQdVx4bYP9jCQpD6JqLie2KEfkHdjIij1Axa6kuUczVTSiw7 JJA4wrMGPnOfqMK5+sldOalIFDQAOo/Oid1/ZviL50OWQh7VkadSOnboS3AEfiWrCae+IG aGuv00ZtUKwFqcO3pSWTQ66AZlYwmTw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-168-Aag7nKneMkuxngkgxQu7uA-1; Tue, 01 Sep 2020 12:53:22 -0400 X-MC-Unique: Aag7nKneMkuxngkgxQu7uA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8A8BD10ABDA7; Tue, 1 Sep 2020 16:53:20 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.40.192.114]) by smtp.corp.redhat.com (Postfix) with SMTP id 283C87C558; Tue, 1 Sep 2020 16:53:16 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Tue, 1 Sep 2020 18:53:20 +0200 (CEST) Date: Tue, 1 Sep 2020 18:53:16 +0200 From: Oleg Nesterov To: Christian Brauner Cc: linux-kernel@vger.kernel.org, Christian Brauner , "Peter Zijlstra (Intel)" , Ingo Molnar , Thomas Gleixner , "Eric W. Biederman" , Kees Cook , Sargun Dhillon , Aleksa Sarai , linux-kselftest@vger.kernel.org, Josh Triplett , Jens Axboe , linux-api@vger.kernel.org Subject: Re: [PATCH 1/4] pidfd: support PIDFD_NONBLOCK in pidfd_open() Message-ID: <20200901165315.GD4386@redhat.com> References: <20200831134551.1599689-1-christian.brauner@ubuntu.com> <20200831134551.1599689-2-christian.brauner@ubuntu.com> <20200901162309.GB4386@redhat.com> <20200901163308.mwd334y462fmml6s@wittgenstein> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200901163308.mwd334y462fmml6s@wittgenstein> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/01, Christian Brauner wrote: > > On Tue, Sep 01, 2020 at 06:23:10PM +0200, Oleg Nesterov wrote: > > On 08/31, Christian Brauner wrote: > > > > > > --- /dev/null > > > +++ b/include/uapi/linux/pidfd.h > > > @@ -0,0 +1,12 @@ > > > +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ > > > + > > > +#ifndef _UAPI_LINUX_PIDFD_H > > > +#define _UAPI_LINUX_PIDFD_H > > > + > > > +#include > > > +#include > > > + > > > +/* Flags for pidfd_open(). */ > > > +#define PIDFD_NONBLOCK O_NONBLOCK > > > + > > > +#endif /* _UAPI_LINUX_PIDFD_H */ > > > > Why? Can't we simply use O_NONBLOCK ? > > It's the same thing we seem to do for any other (anon inode) fds: > > include/linux/eventfd.h:#define EFD_NONBLOCK O_NONBLOCK > include/uapi/linux/inotify.h:#define IN_NONBLOCK O_NONBLOCK > include/uapi/linux/signalfd.h:#define SFD_NONBLOCK O_NONBLOCK > include/uapi/linux/timerfd.h:#define TFD_NONBLOCK O_NONBLOCK > > also for O_CLOEXEC: > > include/linux/eventfd.h:#define EFD_CLOEXEC O_CLOEXEC > include/linux/userfaultfd_k.h:#define UFFD_CLOEXEC O_CLOEXEC > include/uapi/linux/eventpoll.h:#define EPOLL_CLOEXEC O_CLOEXEC > include/uapi/linux/mount.h:#define OPEN_TREE_CLOEXEC O_CLOEXEC > include/uapi/linux/perf_event.h:#define PERF_FLAG_FD_CLOEXEC (1UL << 3) /* O_CLOEXEC */ > include/uapi/linux/signalfd.h:#define SFD_CLOEXEC O_CLOEXEC > include/uapi/linux/timerfd.h:#define TFD_CLOEXEC O_CLOEXEC > > So I think we should just do the same. Hmm, OK, then I have to agree. > A clean flag namespace seems > nicer to me too tbh. Disagree but this doesn't matter ;) Oleg.