Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1638413ybz; Thu, 23 Apr 2020 02:49:31 -0700 (PDT) X-Google-Smtp-Source: APiQypL+ZnzhXHbz/nBtPgeTBZ51O7KP4TcACSc7CaJcjOSYnaneF/kHle8Dq98nEvO5jci/i0x5 X-Received: by 2002:a17:906:4f03:: with SMTP id t3mr1861442eju.254.1587635371020; Thu, 23 Apr 2020 02:49:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587635371; cv=none; d=google.com; s=arc-20160816; b=A89tl3eSTAvbRAYLhw0RqV+B4EnFjXwFZ3+9pDbrQ6+VPo/PvHT851iZZ7xcJip4er bPrCbkJyVrR28n6unlGF6uLki+KT0NrHj7f9PLEML76RLpHf5MbQVm/gXWwgCs07Ynh6 5dh3LO+wWcHAFq76FyLeaXQwAZXSFLKz9OPYv03IS8SaUnoG7oFpP8l77ckLouwVaGQ4 ohr2MbnBOqcIiP/9fRwP+1ROPwGwfufdYZfDAHErkxWWNb/JSOgzaznYiSxm42TPzjv5 CJGYmR4pvl4SUeN+17zpSPakVoZo2qsegMEg/7yd6imoMJESDGjVm5DB1rgp6Sgvlt46 eW5w== 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=eBjF9qj4VjUI/zoZpRsdcofUh4Hml8aXIqDYnm8I2pc=; b=HNu2cIMVOuZunlrdrKQ87jOtxKfyfYORPjVu+dZOIxiqsEkV+YALoXZ7NZKC1j/xMc i+RZ0iWYNQ+O6nFFv1uT+tW5SK2rP9jtPyE+oYWaRcCQOSOtfwuyGbn/kwMvKw0a1gaY 8MBAwUKRmthI7z64iUaXFr4wiLtl1YuZRbWWjgp61Fm+XzGRpkNRXp6EX7rxJ0V8YWWg 9qWpxDvSrznwNGqI6q6rSi+YxROInbZqfdUuGDq3I1Rk5GjuHGN1AUMtxYt1KlcllMGV fjVUJH70vbeItKesBFMrxJ0TRGT1XvFz1rZ9hkjDYKaUul1OE6ELtHNn7EpBzpgGL+F4 3GMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=Kqsnyt0q; 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 gj19si960606ejb.297.2020.04.23.02.49.07; Thu, 23 Apr 2020 02:49:31 -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=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=Kqsnyt0q; 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 S1727019AbgDWJrN (ORCPT + 99 others); Thu, 23 Apr 2020 05:47:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726953AbgDWJrM (ORCPT ); Thu, 23 Apr 2020 05:47:12 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45D4BC08E859 for ; Thu, 23 Apr 2020 02:47:12 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id a2so4239809ejx.5 for ; Thu, 23 Apr 2020 02:47:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=eBjF9qj4VjUI/zoZpRsdcofUh4Hml8aXIqDYnm8I2pc=; b=Kqsnyt0qkv6L86PfeD2KkzVB6KcD+1wQcWQMNqF6WL3KZ5iZir2mKjmxbzENryVDmR h2KN673yOUpiqe96og6uDdVruUvcsVVl1dfoc8u25NFe2q3KdTuW2ZaTL0u/LLsSYeNl S6piTbwiNJ2aGNlQCA8j4IDc0gBm31CEqEtAQ= 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=eBjF9qj4VjUI/zoZpRsdcofUh4Hml8aXIqDYnm8I2pc=; b=SLzgFKtpBPyfT+cLIvS7AC3GBvmKhMQirmGGt06/rGeE9JWrJ9VJKy1i6lE85owyiH 4AvFWunX1JTtiRfEyNnyEOxIzyty9JbkqqIMQtH3wd/67u7gob5kSLZA2DHNWIEk+/F7 /yOlMDvpZUYWZ6t+IFb6h3V3/fLXr7LfmbsCv+N3orZY28CYfGDKmp3Tzuaaf4wFRYFs /2m9ekagXdWmxsWi495u0A/xMoVqdek2LG67nPTYvd3x2nhuq3VrKt0N0M1pgsWXIRnx iquF1nBG/nFzQRh6pgvb/thwfETpCipeqU/p5XsxcUNfpkISoNfVHtOxywdhEnSyhyPR oYTw== X-Gm-Message-State: AGi0PuY0YJ4fKvql1RlveMEPiBpgtMiZ/rmHU8ARbv95AhIK0TWJwvTd GK8NOJFF5HHK5Mt9C8P82qI8kpzMxkuu5DX5JnmZjg== X-Received: by 2002:a17:906:c06:: with SMTP id s6mr1856032ejf.198.1587635230925; Thu, 23 Apr 2020 02:47:10 -0700 (PDT) MIME-Version: 1.0 References: <9873b8bd7d14ff8cd2a5782b434b39f076679eeb.1587531463.git.josh@joshtriplett.org> <20200423004807.GC161058@localhost> <20200423044226.GH161058@localhost> <20200423073310.GA169998@localhost> In-Reply-To: From: Miklos Szeredi Date: Thu, 23 Apr 2020 11:46:59 +0200 Message-ID: Subject: Re: [PATCH v5 2/3] fs: openat2: Extend open_how to allow userspace-selected fds To: Josh Triplett Cc: Michael Kerrisk , io-uring@vger.kernel.org, "linux-fsdevel@vger.kernel.org" , lkml , Alexander Viro , Arnd Bergmann , Jens Axboe , Aleksa Sarai , linux-man , Linux API 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 Thu, Apr 23, 2020 at 11:20 AM Miklos Szeredi wrote: > > On Thu, Apr 23, 2020 at 9:57 AM Miklos Szeredi wrote: > > > > On Thu, Apr 23, 2020 at 9:45 AM Miklos Szeredi wrote: > > > > > > I would prefer to not introduce that limitation in the first place, and > > > > instead open normal file descriptors. > > > > > > > > > The point of O_SPECIFIC_FD is to be able to perform short > > > > > sequences of open/dosomething/close without having to block and having > > > > > to issue separate syscalls. > > > > > > > > "close" is not a required component. It's entirely possible to use > > > > io_uring to open a file descriptor, do various things with it, and then > > > > leave it open for subsequent usage via either other io_uring chains or > > > > standalone syscalls. > > > > > > If this use case arraises, we could add an op to dup/move a private > > > descriptor to a public one. io_uring can return values, right? > > > > > > Still not convinced... > > > > Oh, and we haven't even touched on the biggest advantage of a private > > fd table: not having to dirty a cacheline on fdget/fdput due to the > > possibility of concurrent close() in a MT application. > > > > I believe this is a sticking point in some big enterprise apps and it > > may even be a driving force for io_uring. > > https://lwn.net/Articles/787473/ > > And an interesting (very old) article referenced from above, that > gives yet a new angle on fd allocation issues: > > https://lwn.net/Articles/236843/ > > A private fd space would be perfect for libraries such as glibc. Ah, io_uring already implements a fixed private fd table via io_uring_register(IORING_REGISTER_FILES,...), we just need a way to wire up open, socket, accept, etc. to fill a slot in that table instead of, or in addition to allocating a slot in the fd_table. Thanks, Miklos