All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Fernando Fernandez Mancera <fmancera@suse.de>
Cc: netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
	Aleksandra Rukomoinikova <ARukomoinikova@k2.cloud>
Subject: Re: [PATCH nf] netfilter: nf_conncount: increase connection clean up limit to 64
Date: Tue, 16 Dec 2025 16:25:40 +0100	[thread overview]
Message-ID: <aUF59KJs9ghiGBdR@strlen.de> (raw)
In-Reply-To: <3f651847-9a0e-4007-8790-ffacd90f6e32@suse.de>

Fernando Fernandez Mancera <fmancera@suse.de> wrote:
> This sounds quite expensive to me. What about the following solution?
> 
> 1. In nf_conncount_list, add "unsigned int last_gc_count"
> 2. In __nf_connncount_add the optimization would look like this:
> 
> 	if ((u32)jiffies == list->last_gc && (list->count - list->last_gc_count) >=
> CONNCOUNT_GC_MAX_NODES - 1)
> 	goto add_new_node;

Won't that rescan the same entries for as long as the condition
persists?

That was the reason for the move-to-tail, so we start with something
that we did not scan yet.

> 3. After gc, we update the list->last_gc_count.
> 
> This way we make sure the optimization is not done if 7 or more connections
> were added to the list.

How many entries could be expected per seconds?  I think "tens of
thousands" is possible. If not, then just increasing the GC_MAX_NODES
would work.

If we can't make this work, no choice but to add a destructor callback
to conntrack... I very much dislike that idea.

> It should ensure that the list does not fill up. For
> better optimization, we can increase the number to 64 as I proposed. The
> solution you proposed works too but I am worried that it will trigger a CPU
> lockup for a big amount of connections..

You could add "start = jiffies" and break on "jiffies != start",
which would split the gc over multiple add requests.

  reply	other threads:[~2025-12-16 15:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-16 12:24 [PATCH nf] netfilter: nf_conncount: increase connection clean up limit to 64 Fernando Fernandez Mancera
2025-12-16 12:44 ` Rukomoinikova Aleksandra
2025-12-16 13:07   ` Fernando Fernandez Mancera
2025-12-16 13:16     ` Rukomoinikova Aleksandra
2025-12-16 13:38 ` Florian Westphal
2025-12-16 15:09   ` Fernando Fernandez Mancera
2025-12-16 15:25     ` Florian Westphal [this message]
2025-12-16 15:48       ` Fernando Fernandez Mancera
2025-12-16 16:06         ` 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=aUF59KJs9ghiGBdR@strlen.de \
    --to=fw@strlen.de \
    --cc=ARukomoinikova@k2.cloud \
    --cc=coreteam@netfilter.org \
    --cc=fmancera@suse.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.