Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1862447pxb; Thu, 28 Oct 2021 11:25:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKgAVbyO53TDLWWtS2ghjQ1VX1UT8G12RawPED6p8EtbLvPrBfSsxw1tyGjIxz1IcJhQVD X-Received: by 2002:a65:6a0f:: with SMTP id m15mr4439389pgu.298.1635445505394; Thu, 28 Oct 2021 11:25:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635445505; cv=none; d=google.com; s=arc-20160816; b=DtsEtvn8FvgU6kXma81yHeryr3s+AwCL8qPxSFII8X2HYahO1uexPAOmm3y2KgLRLS gBu2ZlPMeG3wlIWeiIOIGf9rCiIkTYUA6iyzBUvC2RG3w3FGrJIyI9Td0/EWeQyApEaB +zPFc2nIvYITzl9fIRt6MQiEvS4U7H60P/ydwxgdrgGSk4c/69z3PxKUlPPkM7DyJE0x wrXRbVBVwaKIZTNcUAMpqIG3OkDmPtff+tG4M9zMwpYOABe4OtvtaDMzit9CEXyMY2XK K7Tdx6MniHgffh9SNmlhPipiISgfVklHDgQsA474NKYRZ4tgRmWZ98od0yIjTPm85buz T6iA== 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=/dQjBtihCGzCzk4sWaJtlIxEMe6bvTILkJmUOOEk/+A=; b=TTPWOHAm/9oAJeq5BYaT8yjpcDd+T38uCQ2zco73SURAzoxV7KMI6WiwjSNyi5ECEg edSAi8X11Y4nWwjN59xF6H+m7Vh8WGOT/n29+Y529J3i99DANd6LmvsXZ+lHpEuaCNc5 zr9STOyOtBoCNA3yuUp7sSP9XFQRmmf6oUrcFhk1BWHUr1YQbSLmmWCv/vZg76BDPvts FJ9W86JJMkUppYePu2G20NiQ34FxOipGR/ttopIknhXxhNrcSe35zUu4zpMaoOjeLkYB ywF7Ebc1ZzqV61TT38WqVWgBR/cYAuIFfK3HOyLpkg8h2kukPfnRG4Dx8TbtrWjmPqTE ygUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20210112.gappssmtp.com header.s=20210112 header.b=qQzgyM9+; 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 m21si6342174pgu.294.2021.10.28.11.24.51; Thu, 28 Oct 2021 11:25:05 -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.20210112.gappssmtp.com header.s=20210112 header.b=qQzgyM9+; 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 S230325AbhJ1SZW (ORCPT + 99 others); Thu, 28 Oct 2021 14:25:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230435AbhJ1SZS (ORCPT ); Thu, 28 Oct 2021 14:25:18 -0400 Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB4FAC061767 for ; Thu, 28 Oct 2021 11:22:51 -0700 (PDT) Received: by mail-il1-x135.google.com with SMTP id s3so8002272ild.0 for ; Thu, 28 Oct 2021 11:22:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20210112.gappssmtp.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=/dQjBtihCGzCzk4sWaJtlIxEMe6bvTILkJmUOOEk/+A=; b=qQzgyM9+6/Neq0qzf0bVuG0UN3cPEidy2yx2e9I4UAfTT415rHOjLkEeBU4uxzGJyW 4lBvp86JQ+Re95L4OjhFw+rwdVa5VffUPZoydRoDMb1YCYKGD/wD1WEc9HwpJLOozU6V Nx4Cy+Y9QW5SM6Pkh/MXtnfd5y5/nuqnITavsYamlBjXNixn1cq5wr0ulM++CUxyTjN9 AHUk2x9z1XNq0rQb4Qo+ZSLvQmU0EuhyqRiaLqjZXQK1PKmLCGtq6ob5y+TN6rKBYQhC XkzTwtOMV6R/mc0Vh5qDLSec3zQzr++aP/MbdB+nYC0B4CIpXHVLBCdWZrA9SpXKmN2v etQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=/dQjBtihCGzCzk4sWaJtlIxEMe6bvTILkJmUOOEk/+A=; b=R2DdvEjI1MzwMJ/WyI4JODcMcHw3+3GADr6EGKibKPjiT0FM8Bd+nYYRZpYVNOA012 565QW//n/Ky7PT/+WdIDVMBWY5o8UGflHH/7zC+hSVy6+bK2HrAL38cAp80wZEuiFg7m e6xMNBJ1gdnt1XYVHumQeQDLHwoXAVcatvZ8IIcxYCBb/iL0sEczru8TKRWZJIptoMbq qDjz1feNu5uiz6hFEnIbhsnLXChmYnKxXAwxpOelVfm+W7sWR67K7eXoNLkdUKR+Mei+ DuCgbxxMv2ahCI/6zluG2PIGdFT0uiiCbTk4G0zwCKuOuK60XM8G5InqzBX5A8EE49U7 eDSA== X-Gm-Message-State: AOAM532aW4omxzDGEvcdTkEtYMOcChMSUveyt3CbtFsNrygpUGhj7UJE inHTrd/5hmbvsIqktCxQsw3WEQ== X-Received: by 2002:a92:8751:: with SMTP id d17mr1755422ilm.104.1635445371144; Thu, 28 Oct 2021 11:22:51 -0700 (PDT) Received: from [192.168.1.30] ([207.135.234.126]) by smtp.gmail.com with ESMTPSA id m7sm1890990iov.30.2021.10.28.11.22.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Oct 2021 11:22:50 -0700 (PDT) Subject: Re: [PATCH] Increase default MLOCK_LIMIT to 8 MiB To: Drew DeVault , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, io-uring@vger.kernel.org Cc: Pavel Begunkov References: <20211028080813.15966-1-sir@cmpwn.com> From: Jens Axboe Message-ID: Date: Thu, 28 Oct 2021 12:22:50 -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: <20211028080813.15966-1-sir@cmpwn.com> 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 10/28/21 2:08 AM, Drew DeVault wrote: > This limit has not been updated since 2008, when it was increased to 64 > KiB at the request of GnuPG. Until recently, the main use-cases for this > feature were (1) preventing sensitive memory from being swapped, as in > GnuPG's use-case; and (2) real-time use-cases. In the first case, little > memory is called for, and in the second case, the user is generally in a > position to increase it if they need more. > > The introduction of IOURING_REGISTER_BUFFERS adds a third use-case: > preparing fixed buffers for high-performance I/O. This use-case will > take as much of this memory as it can get, but is still limited to 64 > KiB by default, which is very little. This increases the limit to 8 MB, > which was chosen fairly arbitrarily as a more generous, but still > conservative, default value. > --- > It is also possible to raise this limit in userspace. This is easily > done, for example, in the use-case of a network daemon: systemd, for > instance, provides for this via LimitMEMLOCK in the service file; OpenRC > via the rc_ulimit variables. However, there is no established userspace > facility for configuring this outside of daemons: end-user applications > do not presently have access to a convenient means of raising their > limits. > > The buck, as it were, stops with the kernel. It's much easier to address > it here than it is to bring it to hundreds of distributions, and it can > only realistically be relied upon to be high-enough by end-user software > if it is more-or-less ubiquitous. Most distros don't change this > particular rlimit from the kernel-supplied default value, so a change > here will easily provide that ubiquity. Agree with raising this limit, it is ridiculously low and we often get reports from people that can't even do basic rings with it. Particularly when bpf is involved as well, as it also dips into this pool. On the production side at facebook, we do raise this limit as well. Acked-by: Jens Axboe -- Jens Axboe