Received: by 2002:a05:6a10:c7d3:0:0:0:0 with SMTP id h19csp690046pxy; Sat, 14 Aug 2021 20:44:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoKseoWA0n4An8AY5EY7VH6j0Qc/7p3b83prpAtDzEYfqDqv8PmyPuj6H4tlfqp3u/uHmM X-Received: by 2002:a05:6402:2928:: with SMTP id ee40mr9632447edb.191.1628999041989; Sat, 14 Aug 2021 20:44:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628999041; cv=none; d=google.com; s=arc-20160816; b=jSuNVPnTKfnaH2j17elA/cAo/ZkyxjpqH1rfxm0L5A9bKg2+yYrw8Vp/Q31mahXZ52 egcH9DzprratasCTguAxA4SgqQX9w6AlCWNsIvuj62wp8s9S+qqgMu5hKN4FjheQpIBw XsuWtfpwADjVrnqPBxpQYj+gioydyRi/UQh7WA3GPQtfFdjRVsmpTE/ISUHFC+b0Df/d XHVzkTNfJJQt6x7Cd5zJFXsDlD7lA0DVKeVFJuUBGsURKTmy4tLbS0oJOXUqCh0kDaWG Ajv4tC7AjXfE3XFZaKictlUczAziAwUPjpFjNe7Qc9Tr0iLeCpbeh/bfC22X34ZTr2Ww R1Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=fscQQUiCrfJu2B/FroGWlGgv8rX7vCHNTDmiXT/+3qg=; b=rcEqh7I4ZmN4p+yhyX1nPAqh71qJY6aq5TnRIBESHeB6HiIeMzL3M9RG/uUm+EeUHI aFUUOO4FegeZ1q9YTzAGtYpVaqI6h1KD9Umsfrv4C7uECjlebxPWTIM/M4Fscrz4euPu v8JMvw9XQRMmYAz5zIByOOf/al43p1oeOqqPA0CElehYLnYeXPD2Jz1Yt/PKjiAoXov6 u5HooO4TAdQ/iHWU7mhjj3+ooAtM+zeaxsmO2KbCxKZsuKzH1Pqj/KWq63tDGTM6HQUB vGdYGKRwyIv8aLYhwz8uAMwJSCb6nI0lKICT4d1mx36AiwNZ2S0NEPxQYwE/R8XdeESo FgIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joshtriplett.org header.s=fm1 header.b=HPv8LWAW; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=d+z6GWPi; 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 h15si6669637eds.513.2021.08.14.20.43.38; Sat, 14 Aug 2021 20:44:01 -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=@joshtriplett.org header.s=fm1 header.b=HPv8LWAW; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=d+z6GWPi; 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 S235318AbhHODmy (ORCPT + 99 others); Sat, 14 Aug 2021 23:42:54 -0400 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:49187 "EHLO wout5-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233848AbhHODmv (ORCPT ); Sat, 14 Aug 2021 23:42:51 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 8415C320046E; Sat, 14 Aug 2021 23:42:21 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sat, 14 Aug 2021 23:42:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= joshtriplett.org; h=date:from:to:cc:subject:message-id :references:mime-version:content-type:in-reply-to; s=fm1; bh=fsc QQUiCrfJu2B/FroGWlGgv8rX7vCHNTDmiXT/+3qg=; b=HPv8LWAWIBoYE5/gick zpULfhUf6sx7a1h7vcfHUgp1AgSThKYiQzOu30lYEEcOzBfdHr0fnSSJO1eI+ShK IOY2S8GA5uWCjzzN6Fm3TXcIVOaY/XsKXk0MpxWbJQr+vKCgbnop28IU0dye3V1Q BdB+TfzzOCI8MgQv/P/zA5OLC/N0isk8eWObyLRW23Wzl1067q1efxRMLYQ3fsKi VLrzYLOyDvghyfn/ql0Q5IsUbsjdoUUzSLu1rOWeFCAcNQ/QAQEVa1gtrMvcouWK aOLCXSr/ktBmntQexAZ/ABZT839MvkaAL5aodmmVrXaKKhixhBC4PYBfc8b99ob1 eJA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=fscQQU iCrfJu2B/FroGWlGgv8rX7vCHNTDmiXT/+3qg=; b=d+z6GWPiqYOBUwIpYT1EfA RH4GJXsLkVCjT5UzWtYBuB5mjFBddQG51Emp7tRed027+Co8+84j3eOfnByCrh4k opaagkyrbb99WWcfmRb9xHXIkp9mV08voXfJsXDF6uT3p5u6irKQ7QK8x1rXSxqP Eihu0qU5Ja/NG09ZeFMxGosz781ChYQwSQ+Mug9xajxbnRCb9v+ohjujj1prlVc2 pAotL1nY7A6DfI4p/oal8QBGV4XsSHxiZWFmUgZCkg62yxBcTQeZeUVZAeCBClQZ sFV/DBrpv31EptWIDhXr51Fb7HffAD1mxR2sEGFU33cJOIJMfwU8OevTE2fEYYig == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrkeekgdejgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomheplfhoshhhucfv rhhiphhlvghtthcuoehjohhshhesjhhoshhhthhrihhplhgvthhtrdhorhhgqeenucggtf frrghtthgvrhhnpeegtdfgfeeghfevgeelgfefieegudeuheekkedtueeutefgheffveeg ueeiteehteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehjohhshhesjhhoshhhthhrihhplhgvthhtrdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 14 Aug 2021 23:42:18 -0400 (EDT) Date: Sat, 14 Aug 2021 20:42:17 -0700 From: Josh Triplett To: Jens Axboe Cc: Pavel Begunkov , io-uring@vger.kernel.org, "David S . Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Stefan Metzmacher Subject: Re: [PATCH v2 0/4] open/accept directly into io_uring fixed file table Message-ID: References: <5cf40313-d151-9d10-3ebd-967eb2f53b1f@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5cf40313-d151-9d10-3ebd-967eb2f53b1f@kernel.dk> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Aug 14, 2021 at 05:03:44PM -0600, Jens Axboe wrote: > What's the plan in terms of limiting the amount of direct descriptors > (for lack of a better word)? That seems like an important aspect that > should get sorted out upfront. [...] > Maybe we have a way to size the direct table, which will consume entries > from the same pool that the regular file table does? That would then > work both ways, and could potentially just be done dynamically similarly > to how we expand the regular file table when we exceed its current size. I think we'll want a way to size the direct table regardless, so that it's pre-allocated and doesn't need to be resized when an index is used. Then, we could do one of two equally easy things, depending on what policy we want to set: - Deduct the full size of the fixed-file table from the allowed number of files the process can have open. So, if RLIMIT_NOFILE is 1048576, and you pre-allocate 1000000 entries in the fixed-file table, you can have no more than 48576 file descriptors open. Stricter, but potentially problematic: a program *might* expect that it can dup2(some_fd, nofile - 1) successfully. - Use RLIMIT_NOFILE as the maximum size of the fixed-file table. There's precedent for this: we already use RLIMIT_NOFILE as the maximum number of file descriptors you can have in flight over UNIX sockets. I personally would favor the latter; it seems simple and straightforward.