Re: [REGRESSION] 6.18.14 netfilter/nftables consumes way more memory
From: Chris Arges
Date: Fri Mar 06 2026 - 13:20:26 EST
On 2026-03-06 13:25:44, Pablo Neira Ayuso wrote:
<snip>
> > I see what is going on, my resize logic is not correct. This is
> > increasing the size for each new transaction, then the array is
> > getting larger and larger on each transaction update.
> >
> > Could you please give a try to this patch?
>
> Scratch that.
>
> Please, give a try to this patch.
>
> Thanks.
Pablo,
Thanks, I'm getting this set up on a few machines. I will have:
- 6.18.15 (original kernel version that repo'd the issue for us)
- 6.18.15 + this patch
- 6.18.15 + revert rbtree patchseries
I'll compare memory usage with those 3 variants and give a response.
--chris
> diff --git a/net/netfilter/nft_set_rbtree.c b/net/netfilter/nft_set_rbtree.c
> index 853ff30a208c..cffeb6f5c532 100644
> --- a/net/netfilter/nft_set_rbtree.c
> +++ b/net/netfilter/nft_set_rbtree.c
> @@ -646,7 +646,7 @@ static int nft_array_may_resize(const struct nft_set *set)
> struct nft_array *array;
>
> if (!priv->array_next) {
> - array = nft_array_alloc(nelems + NFT_ARRAY_EXTRA_SIZE);
> + array = nft_array_alloc(priv->array->max_intervals);
> if (!array)
> return -ENOMEM;
>