Article View: linux.kernel.netdev
Article #26083Re: [PATCH RFC nf-next 0/9] netfilter: nfqueue: account queued memory and reserve capacity
From: Alireza Asgari
Date: Thu, 03 Dec 2026 01:24
Date: Thu, 03 Dec 2026 01:24
75 lines
14075 bytes
14075 bytes
Hi Chris, Thanks for looking at this, and sorry for the slow reply. > They would just need exporting. I'll try obj_cgroup_charge() and obj_cgroup_uncharge() on the objcg captured at BIND. On my base, the helpers take a size_t but use unsigned int for byte counts in the per-CPU stock. I'll check the largest charge and refund, and what happens if the owner cgroup is removed while the queue still holds a charge. > most of that memory could be reclaimed. Agreed. I'll try allowing reclaim during queue configuration and check that a failed resize leaves the previous configuration usable. > the excess doesn't have to come back as the queue drains. Yes. On shrink I'll keep enough charged for the larger of the new limit and the bytes still held. If those packets drain, the surplus can stay charged until the next configuration change or queue destruction. That lets me drop the refund worker. Thanks, Alireza From: Chris Down <chris@chrisdown.name> To: "Alireza Asgari via B4 Relay"<devnull+alireza.asgari.net@kernel.org> Cc: <netfilter-devel@vger.kernel.org>, <linux-mm@kvack.org>, "Johannes Weiner"<hannes@cmpxchg.org>, "Michal Hocko"<mhocko@kernel.org>, "Roman Gushchin"<roman.gushchin@linux.dev>, "Shakeel Butt"<shakeel.butt@linux.dev>, "Muchun Song"<muchun.song@linux.dev>, "Andrew Morton"<akpm@linux-foundation.org>, "David Hildenbrand"<david@kernel.org>, "Pablo Neira Ayuso"<pablo@netfilter.org>, "Florian Westphal"<fw@strlen.de>, "Phil Sutter"<phil@nwl.cc>, "Shuah Khan"<shuah@kernel.org>, "Tejun Heo"<tj@kernel.org>, "Vladimir Davydov"<vdavydov.dev@gmail.com>, "Zhang Jiao"<zhangjiao2@cmss.chinamobile.com>, "Song Hu"<husong@kylinos.cn>, <cgroups@vger.kernel.org>, <netdev@vger.kernel.org>, <linux-kselftest@vger.kernel.org>, "Alireza Asgari"<alireza@asgari.net> Date: Wed, 18 Nov 2026 04:38:43 +0100 Subject: Re: [PATCH RFC nf-next 0/9] netfilter: nfqueue: account queued memory and reserve capacity > Hi Alireza, > > Alireza Asgari via B4 Relay writes: > >3. Whether the proposed bulk reservation interface is an appropriate MM > > interface for this use, including the explicit restriction of charged > > growth to 64-bit kernels. Is this compatibility tradeoff acceptable for > > the initial interface? > > Hmm, I don't think this needs a new interface. obj_cgroup_charge() and > obj_cgroup_uncharge() on the objcg you take at BIND already deal with root > ownership, reparenting and the kmem statistics, which is most of what patch > 4 reimplements. They would just need exporting. > > >4. Whether non-reclaiming reservation growth is the desired failure policy. > > I don't think so. A long-running cgroup usually sits at memory.max, mostly > with page cache, so resizing the queue would fail with ENOMEM even though > most of that memory could be reclaimed. > > >Increasing capacity obtains the additional reservation before publishing > >the new limit. Failure leaves the existing configuration intact. Shrinking > >preserves queued packets and retains page-rounded backing for the greater > >of the configured allowance and outstanding saved charges. Excess capacity > >is refunded as entries drain, with refund work serialized against resizing > >and coordinated with queue destruction. Refunds settle the actual memory > > Keeping the charge at the larger of the limit and the bytes still queued > makes sense. Otherwise one could shrink a full queue, charge the refund to > another queue, and leave the old packets uncharged. But, unless I'm > mistaken, the excess doesn't have to come back as the queue drains. > Configuration already runs under the nfnl subsystem mutex, so if the excess > is released at the next configuration change or when the queue is > destroyed, it looks like mem_work, mem_mutex and mem_stopping can all go. > > Thanks! > > Chris >
Technical Details
Message-ID:
<1a23980510b.3d4752d5694007.6472714936139772114@asgari.net>Path:
mbox-mo1.pugleaf.net!news-fra.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376192-linux-kernel-netdev=dewy.ruReferences:
<20261115-b4-nfqueue-memory-accounting-v1-0-b9cc30819997@asgari.net> <av0dwzvTBXXLqWCa@chrisdown.name>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-fra.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376192-linux-kernel-netdev=dewy.ru From: alireza@asgari.net (Alireza Asgari) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH RFC nf-next 0/9] netfilter: nfqueue: account queued memory and reserve capacity Date: Thu, 03 Dec 2026 02:24:00 +0100 Organization: Usenet Network Message-ID: <1a23980510b.3d4752d5694007.6472714936139772114@asgari.net> References: <20261115-b4-nfqueue-memory-accounting-v1-0-b9cc30819997@asgari.net> <av0dwzvTBXXLqWCa@chrisdown.name> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="2105632"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:rFuwlXiayGXu1FglcVSdWbKM/yM= sha256:zjnR3NYk0+ipnIWuBUOl3qsxtpJ52nRgjpvZ3vaGRb4= sha1:9+n4UMHN8Y01IMebA5Oj8g2H65E= sha256:hI9jdiMFyl6M0/eRIWbEI+7rh0/zL38YGddAh7kQquU= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 03428114027; Thu, 3 Dec 2026 04:25:04 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -2.751 X-Spam-Status: No, score=-2.751 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=fail (1024-bit key) reason="fail (message has been altered)" header.d=asgari.net X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Otuvh4664HMq; Thu, 3 Dec 2026 04:24:56 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376192-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=asgari.net X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 17E64116175; Thu, 3 Dec 2026 04:24:46 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 1E18D29471; Thu, 3 Dec 2026 01:24:41 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796261080; b=pwvgNDNl3F2MFdOMmu3lqQ4TditXak7FekENaXe75Ows3ExLpi42hE4dl63xybLFEXrm 8Dh6+Wxrxy9luqJLQ3fUtXVK+GC/vGjWaN/nYQzZ/z/KKXYXagIiW9VaUC9wxS5YT37G0 G968HBoCPycwsOPYuBU0Jmk7eN89Js5kpB80Z0QsjRlnn1+I4h4/BXK1ts/PacVI+hbSd hH5T4xC+Jl3X9UuH9Sd7gno0tJXNCmd3Am1QC6g5hrUnWwxl82Q37Vs4McVVVCP4lEKo5 YMOq8BnhrDLEFV7+vYDpPa5ygrJD3+Ml+6OT+x3VMF4b1EHc/lKn5QrqKEG/EiPSf+w== X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796261080; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:Date: From:To:Cc:Message-ID:In-Reply-To:References:Subject:X-Mailing-List: List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe: List-Owner:Precedence:MIME-Version:Content-Type: Content-Transfer-Encoding:Importance:User-Agent:X-Mailer; bh=stOpbKJR9rvvJYXmo7eGoixQS75g8r1c4iRt5WfX2SU=; b=P1/mLvMXbC7CeLZp71Rd5gY2Ebfo1IisZWCjhzD+NaDnqeMc8/E4VcS0Gil1wgweCsve Xz0PhuGI/uk3czfWOwXNdvG8slWv5mNK+qbSy4t3gCvCUgaZiwbJOAZWOUSGwAfyBHXu1 AZPpDzqRHV59aYld4Kqof3tb4i3wnRXtUTPGuKfOZOyE+UKGPCyALdnhjmM3RU6gAnN+3 /svSD+/a6tInrhh7Kbu6Lm8+Qmz7bslVpzvvLy6Cv+yf1ZQzJdP+avLZ9oiDXqG2fW7+K N0zaN6EXIwy+PLcsG5XVsHL4YdN+W+0MNx4t/WtK989XSegyLc5iSg/OIK1u8y/9+bQ== X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" header.d=asgari.net header.i=@asgari.net header.a=rsa-sha256 header.s=zmail header.b=OoSyUpEM; dmarc=none header.from=asgari.net; spf=pass smtp.mailfrom=asgari.net; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 37FA4606A338; Thu, 3 Dec 2026 01:24:40 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=asgari.net header.i=@asgari.net header.a=rsa-sha256 header.s=zmail header.b=OoSyUpEM X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=136.143.169.50 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796261079; b=S7dQL3tQLbIsnSUL4LBKePW+eq4WfmNFlPUSydFv6br5MmHjmuosvD8bkJ4NmiaMh4wL KQFEL3IJSEdIRLD7cLMfDiFhAswcGACE/U19Cdh5sUlbISCnAYLm0iYSFZY4+oz1DYGj/ UbtYsFtVL/8b1o/+TeAcWb0r9HwGtS5bjnDil4HLXfPhVjYP+sGr4K1TDSAL74jrCphwf Z2dvHySaWiL6W58LWQmHKgAZi4wUKZ3jFNdlE748T6UZABR5O1jhWfKX6u6uP7Nzih4gK 3WEQUUsCzqyzfGbV6vefq3dvgZporV0mR81A3/P7bIeTvwubQAbK/bjpKDmBLXgJmyA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796261079; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Message-ID: In-Reply-To:References:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Importance:User-Agent:X-Mailer; bh=stOpbKJR9rvvJYXmo7eGoixQS75g8r1c4iRt5WfX2SU=; b=YY31cFcla3DOV4Jp5EFH4l7ugouSXmrf5BjWXSQ3TX+gb/j+dZQeFfWIWSeLRhCYNEBH yGE/WRwPhBC1fEYDZSewnPkMiutEi9b0TwSUgEY5O+DJ4NIwUVUGpvAiLaQ0w0Y8i65fV wn0mryVxn7+IKIHRj3k0vodw2sHJ1UzVNS7obqhP4MzJKbwg6Fe0RW0e94wcmwRhAe7P1 zLKXdNSvmh24+Y4PAhZoyHfD9U12CE25O5niWE2gO7h+W896PpAypsRpiTefz9MS3cwQA flDA6J0u9hWldAQ+B630zhMyjVnTmA7LzxNp4GuwnPArKBBNtmGLvLICGXa+RBWw95A== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none header.from=asgari.net; spf=pass smtp.mailfrom=asgari.net; dkim=pass header.d=asgari.net header.i=@asgari.net header.a=rsa-sha256 header.s=zmail header.b=OoSyUpEM; arc=pass header.oldest-pass=0 smtp.remote-ip=136.143.169.50 X-Received: from sender-of-o50.zoho.eu (sender-of-o50.zoho.eu [136.143.169.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC9C2606A322; Thu, 3 Dec 2026 01:24:37 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DC9C2606A322 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=asgari.net X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=asgari.net X-ARC-Seal: i=1; a=rsa-sha256; t=1796261041; cv=none; d=zohomail.eu; s=zohoarc; b=BQAuN1EZOOLnatxn5I++rM3sU2WQoSNQwsvpoVvoQ/p05IyenJSNN052B96krmQ1NJFjYqUKw8PgU7SPC+qS+Ufp1OTnKDUm8gB9pG7cbabfFi5Ag94kPpxYJLuHca+k4DRlcqKXAFwIIjC1vQtSy/yO/BFuVS7csPT62y+yqV8= X-ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1796261041; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=stOpbKJR9rvvJYXmo7eGoixQS75g8r1c4iRt5WfX2SU=; b=Cg/saayvuTsBWDeM/auHC7vqc6Slekmgjco9vWiMnIQiQRysac3a1VXO5fmUelKEeNFKOTfG2Ud91eoMtSvQvudC8LEYLPbbZnySxUNlN61sZEicGWMiwDV5F1wos4Ft+23tfefuqV25v9LnTyvVC2hpN2DtqANvw1/jESF2BKI= X-ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=asgari.net; spf=pass smtp.mailfrom=alireza@asgari.net; dmarc=pass header.from=<alireza@asgari.net> X-DKIM-Signature: a=rsa-sha256; b=OoSyUpEMoU9sr6x9q3oUU1tEpfL+7v73kwnWrBbogmRrkTc7nx6DFZgynEf5pQ/lvA4aybnRdLSw6EEk/1uPRmAO/pkd93heba/RYq48huTIcwzzaAvOpxFPE/QqI0etHyLsTtQSviz/JO907J0biUJytIk6HMD1jRZ8phtxqJg=; c=relaxed/relaxed; s=zmail; d=asgari.net; v=1; bh=stOpbKJR9rvvJYXmo7eGoixQS75g8r1c4iRt5WfX2SU=; h=Content-Description:Content-ID:Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Resent-Sender:Resent-Cc:Resent-Date:Resent-To:Reply-To:Resent-Message-ID:Resent-From:Sender:Subject:To:Date:From:Message-Id:Reply-To:Subject:To:Cc; X-Received: from mail.zoho.eu by mx.zoho.eu with SMTP id 1796261040407239.82189989196013; Thu, 3 Dec 2026 02:24:00 +0100 (CET) X-Cc: "netfilter-devel" <netfilter-devel@vger.kernel.org>, "linux-mm" <linux-mm@kvack.org>, "Johannes Weiner" <hannes@cmpxchg.org>, "Michal Hocko" <mhocko@kernel.org>, "Roman Gushchin" <roman.gushchin@linux.dev>, "Shakeel Butt" <shakeel.butt@linux.dev>, "Muchun Song" <muchun.song@linux.dev>, "Andrew Morton" <akpm@linux-foundation.org>, "David Hildenbrand" <david@kernel.org>, "Pablo Neira Ayuso" <pablo@netfilter.org>, "Florian Westphal" <fw@strlen.de>, "Phil Sutter" <phil@nwl.cc>, "Shuah Khan" <shuah@kernel.org>, "Tejun Heo" <tj@kernel.org>, "Vladimir Davydov" <vdavydov.dev@gmail.com>, "Zhang Jiao" <zhangjiao2@cmss.chinamobile.com>, "Song Hu" <husong@kylinos.cn>, "cgroups" <cgroups@vger.kernel.org>, "netdev" <netdev@vger.kernel.org>, "linux-kselftest" <linux-kselftest@vger.kernel.org> X-In-Reply-To: <av0dwzvTBXXLqWCa@chrisdown.name> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-Importance: Medium X-User-Agent: Zoho Mail X-Mailer: Zoho Mail