Received: by 2002:a05:6a10:c7d3:0:0:0:0 with SMTP id h19csp1045782pxy; Sun, 15 Aug 2021 08:08:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlXY1hl62qAA1rwLgPkYSDchmTkj/mpj07tHlKbuBtPNweJf60QBaBruXflYRyAehVph7K X-Received: by 2002:a17:906:a3c3:: with SMTP id ca3mr11756984ejb.337.1629040097647; Sun, 15 Aug 2021 08:08:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629040097; cv=none; d=google.com; s=arc-20160816; b=zMiomDndmJiXj7QbAL9FcPKib582g+QPkz9J1GIGEf3IFw8SKvGg4z1ZtZPt7/tFU9 7isLiRxzoGHc39prDP10t0j5p6S4hpoI5q2sHvP5HuhY47td6SqDTF6Iqm8xV119NflT LLgSYbTq4c6HOY5nUzBvku0Xfcn+AxMh19jk71Ur9+UgnKYa/yGKBxgEctvtQxmaXYmZ uXzw8EYm8tzNp1qPzMcCsyrixbwDZJqVSUWsfXEQjMQaHI4S63UA0ZJLXyA8/N+uqoGc UPD8vWVHVWk7r4vCU5zdBOZxX5wfKKOY7H4EYeaFnjr0Rtk4Yma3SRgF6yRQmOXOVmfi drvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=K6dRiWVfqPYEGM0XTEKXwwPFa8TOMfctM2bCbgQM+j8=; b=qvJu8zmlH6YbbpufANaCJYhe80fgweZDsIE3OfCdxA5aHPUNmtlPX1iNpatkITxePN vG9hROxZ9WU/bxh25DWrDZfHLTZAeyATdLdGjrApw2pQMK+ai0RAObwWkqB02iRi8KMK EfiovTLWIZetZgfHR7SRJZAqL5wWV1NB57X7SXOO7oazyk2sm0dVpe5wB8ctQa3/KMd6 +5pHiIKxyLJDvOw0/7uijR8rt28iF4/xA67oZyNzfMNG15X7AkgbDOV1Dju4qgjzEkoi Un16+0VFKH2m5KXdTqiyC+k+b/KZGmMgPBFDjXuuAjCnkzdLRSnbsr/BhFeN8+y5b3S4 qVNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=awukKEq7; 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 f2si9388680edl.338.2021.08.15.08.07.31; Sun, 15 Aug 2021 08:08:17 -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=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=awukKEq7; 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 S234850AbhHOPGb (ORCPT + 99 others); Sun, 15 Aug 2021 11:06:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229603AbhHOPGb (ORCPT ); Sun, 15 Aug 2021 11:06:31 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 702A9C061764 for ; Sun, 15 Aug 2021 08:06:01 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id a20so18035683plm.0 for ; Sun, 15 Aug 2021 08:06:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=K6dRiWVfqPYEGM0XTEKXwwPFa8TOMfctM2bCbgQM+j8=; b=awukKEq7lju7+gP8fp5KAmtuR1zsNlohkntw3H98WvFvJYUmm13lITxVn4boMQFLw2 PPez7WBS9vEMXXfMKmzeigCCFJWIzjde/O7sYLV2rli9iRICFRo31ZJgy3+ZyHZa/Hcl JTSfr9BfZcGEKUNHTU+dLBA1G2NXgUB/6Y0a48HOduIsjTB26zDYNJiTMkN5QGv/eVaZ P7czhCYnin2PV0Y4XEN7Y5EYvh5U3AgGooxgzbK5iYMtRh3M99ny07we2LVoSvZOZ4Fr KNjUG2NmVt55ENYY5awmmk8+FaIhCanRWEnUSF+LdflMuLyvP1hcjdFtrWMH/yPH1D0o Y3JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=K6dRiWVfqPYEGM0XTEKXwwPFa8TOMfctM2bCbgQM+j8=; b=n9du3DqQHRbb8yGqS8+89WInXm9mBqsvv8RktAbPhj1V6vLYs9c1I6ZsXf3kyIFx/n sazzHwfLEBi3tr3iT2FNVIPFAyiUoSBnCvjhk8Yo6MFx+ECdx+iY+EM2KWxGEg60UEy5 Ybay2135HVyNtN2P+hJxVb7ITLK0jJntDrhFcb6RCtYabKNLRUJHae3m4kM6Zp4pklcM tQBnR0Lz7iVOr00pf68xqoFhHDbWCLEsQ5M1sK2Nz6qeLkraPlwBmEJxNLZhmG2Z5kH3 XD2XX1nnpZgQGk1RBjTrSkfs8zdqWe0LS4KiisTlcLqaASo22cmNHnlSzQ01omoL21Gt efOA== X-Gm-Message-State: AOAM5310ZPH8E1Ihp5nRexqQflc175Hs0K7Ex8G4kYOdSv9M7TiN6pt8 GoTDA+S2vSGTXrAEoHMfdWPwrA== X-Received: by 2002:a17:902:7611:b029:12b:e55e:6ee8 with SMTP id k17-20020a1709027611b029012be55e6ee8mr9816536pll.4.1629039960768; Sun, 15 Aug 2021 08:06:00 -0700 (PDT) Received: from [192.168.1.116] ([66.219.217.159]) by smtp.gmail.com with ESMTPSA id nl9sm6796837pjb.33.2021.08.15.08.05.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 15 Aug 2021 08:06:00 -0700 (PDT) Subject: Re: [PATCH v2 0/4] open/accept directly into io_uring fixed file table To: Josh Triplett Cc: Pavel Begunkov , io-uring@vger.kernel.org, "David S . Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Stefan Metzmacher References: <5cf40313-d151-9d10-3ebd-967eb2f53b1f@kernel.dk> From: Jens Axboe Message-ID: Date: Sun, 15 Aug 2021 09:05:55 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/14/21 9:42 PM, Josh Triplett wrote: > 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. But how do you size it then? I can see this being used into the hundreds of thousands of fds easily, and right now the table is just an array (though split into segments, avoiding huge allocs). > 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. I strongly prefer the latter too, and hopefully that's palatable since the default limits are quite low anyway. And, as you say, it already is done for inflight fds as well. -- Jens Axboe