All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [RFC nf-next] netfilter: nf_tables: remove element flush allocation
Date: Thu, 7 Aug 2025 13:57:49 +0200	[thread overview]
Message-ID: <aJSUvdpLyFS75wj5@calendula> (raw)
In-Reply-To: <20250731154352.10098-1-fw@strlen.de>

Hi Florian,

On Thu, Jul 31, 2025 at 05:43:49PM +0200, Florian Westphal wrote:
[...]
> One way to resolve this is to allow sleeping allocations, but Pablo
> suggested to avoid the per-element-allocations altogether.
> 
> The main drawback vs the initial patch is that in order to support
> sleeping allocations, memory cost of each set element grows by one
> pointer whereas initial sleeping-allocations only did this for the
> rhashtable backend.
> 
> Not signed off as I don't see this as more elegant as v1 here:
> https://lore.kernel.org/netfilter-devel/20250704123024.59099-1-fw@strlen.de/

Not very elegant, maybe it is just incomplete.

> One advantage however is that NEWSETELEM could be converted to use
> the llist too instead of the dynamically-sized nelems array.

Yes.

> Then, the array could be removed again, it seems dubious to keep it
> just for the update case.

For updates, I think the element would need a scratch area to store
the new timeout/expiration until commit phase is reached. For several
updates on the same element in a batch.

> That in turn would allow to remove the compaction code again.

Yes.

> Both DEL/NEWSETELEM would be changed to first peek the transaction list
> tail to see if a compatible transaction exists and re-use that instead
> of allocating a new one.

Right. Would all this provide even more memory savings?

> Pablo, please let me know if you prefer this direction compared to v1.
> If so, I would also work on removing the trailing dynamically sized
> array from nft_trans_elem structure in a followup patch.

I don't remember when precisely, but time ago, you mentioned something
like "this transaction infrastructure creates myriad of temporary
objects". Your dynamic array infrastructure made it better.

Maybe it is time to integrate transaction infrastrcture more tightly
into the existing infrastructure, so there is not need to allocate so
many ancilliary objects for large sets?

There is a trade-off in all this.

  reply	other threads:[~2025-08-07 11:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-31 15:43 [RFC nf-next] netfilter: nf_tables: remove element flush allocation Florian Westphal
2025-08-07 11:57 ` Pablo Neira Ayuso [this message]
2025-08-07 13:05   ` Florian Westphal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aJSUvdpLyFS75wj5@calendula \
    --to=pablo@netfilter.org \
    --cc=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.