From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f170.google.com (mail-dy1-f170.google.com [74.125.82.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A00A53BBA01 for ; Thu, 8 Oct 2026 19:11:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791486677; cv=none; b=tjKVpxKJ/eCsHwNDDJd9VzPkwzMA/Mc11CsPICghbD12jcsexIzfmVbke7AehjyvyxGf7Hm3NLD35hDsN6Aug9eArW2mH/+yfQUhbfehcyJIFgik3mAtjYIxapmOd3IEI8nzxUTTvfpjXxs9qRPstYKb5kSy0+527jsUiGDQdmM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791486677; c=relaxed/simple; bh=MFI73bLJzYuC3bslZx/bwltYUGd/9Km+EomyS/QsF6I=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=P4tykjkAzhC2yOytA0Q4B0+PBCI6Di+m0WoorZA0xHGbid4yaljcOok+MFtR7fX0z86Y/c9snbrb8IYpAtKqFpjlqrnvLy9UDSC/CwYTLFl5rC+loFPUPZC7ZFjc+z7TFBR6YcerotBz7IuXBhz/JYAy9gWT9mY9DBJ4I1tB+O0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk; spf=pass smtp.mailfrom=kernel.dk; dkim=pass (2048-bit key) header.d=kernel-dk.20251104.gappssmtp.com header.i=@kernel-dk.20251104.gappssmtp.com header.b=sYnEyek+; arc=none smtp.client-ip=74.125.82.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel.dk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel-dk.20251104.gappssmtp.com header.i=@kernel-dk.20251104.gappssmtp.com header.b="sYnEyek+" Received: by mail-dy1-f170.google.com with SMTP id 5a478bee46e88-35115b52125so4476888eec.1 for ; Thu, 08 Oct 2026 12:11:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20251104.gappssmtp.com; s=20251104; t=1791486674; x=1792091474; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=nShr7nk4H6rZOzPK1tKDbu27hRY+4XFOH8yhDaWQWyM=; b=sYnEyek+TRmHxzqqEBt20pXRpW6MO3qFYPBvZLUI+uXtzegKNqFWihSrQj2pq4x9aU eMqB3m3qubnJ2nY5dQwDpzjXxJEM6Nv9W6HwdW6ijEXQk/+xkhe20KFmryzPMOT7u8TA rlvOmIPm07YU/2qJtDPHp+InLtUGuWypYsXn7vIKBHnEPnrCMpq6KPG7W2Tk56/aKvJp OHSb1ovmY6rTMFfDWLbo7JGCDimlKhJd/Zh0DPq2rcTT/qAuLzzWHzbjk1KZnimQ374A 5A+ji3/KCYJqqstR4lcHw8mXNW4eTQs5LlblTCY7SAyHlpkkJupR/D1piSuzFAywpnwO 2Low== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791486674; x=1792091474; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=nShr7nk4H6rZOzPK1tKDbu27hRY+4XFOH8yhDaWQWyM=; b=hqYA1bpUvi27Oy8HJHJnl4B9xKRXnLOzQpBkp8CLbmU8R98Rf/W5m7HponNV9s/YmA opfmMirOgemkfB20A6W+/e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+CIjgszl/kdAB59jaMNg== X-Received: by 2002:a05:7301:9c87:b0:353:5d25:1de7 with SMTP id 5a478bee46e88-3535d252333mr1169990eec.33.1791486673390; Thu, 08 Oct 2026 12:11:13 -0700 (PDT) Received: from [192.168.1.106] ([198.8.77.135]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3537cad9e53sm21393eec.22.2026.10.08.12.11.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Oct 2026 12:11:12 -0700 (PDT) Message-ID: <3b9d9c06-c6e8-4166-87d9-c7c220ad0b58@kernel.dk> Date: Thu, 8 Oct 2026 13:11:11 -0600 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] io_uring: do not charge user provided SQ/CQ rings to RLIMIT_MEMLOCK To: Hengyu Liang Cc: Pavel Begunkov , David Wei , io-uring@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org References: <20261008170611.1285778-1-hengyul@cs.unc.edu> Content-Language: en-US From: Jens Axboe In-Reply-To: <20261008170611.1285778-1-hengyul@cs.unc.edu> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 10/8/26 11:06 AM, Hengyu Liang wrote: > This goes on top of io_uring-7.3 (c746673517c6), as discussed in [2]. > > Tested on that branch as a user without CAP_IPC_LOCK and the default > 8 MiB limit: > > before after > program above 21 64 > the same with io_uring_queue_init() 64 64 > 30 processes x 142 NO_MMAP rings of 64 entries 7 30 > > The last row is what 30 PostgreSQL 18 clusters with default settings > create. The number is how many of them got all their rings. > > The per-user locked_vm count stays balanced over ring create, close and > resize. Provided buffer rings and IORING_REGISTER_MEM_REGION regions on > user memory are charged as before. Every liburing test gives the same > result with and without the patch. > > Not changed here: provided buffer rings on user memory, which is what > io_uring_setup_buf_ring() registers, were not charged in v6.13 either > (64 of 64 rings of 32768 entries then, 16 now). I can send a patch for > those as well if you want them handled the same way. Honestly, after taking a closer look at this, I think we're better off with your original patch and one on top for pbuf rings. Please check: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux.git/log/?h=io_uring-7.3 for the top 2 commits. If you can re-test one more time, that'd be great... -- Jens Axboe