[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aO5K4mICGHVNlkHJ@strlen.de>
Date: Tue, 14 Oct 2025 15:06:42 +0200
From: Florian Westphal <fw@...len.de>
To: lirongqing <lirongqing@...du.com>
Cc: Pablo Neira Ayuso <pablo@...filter.org>,
Jozsef Kadlecsik <kadlec@...filter.org>, Phil Sutter <phil@....cc>,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Simon Horman <horms@...nel.org>, netfilter-devel@...r.kernel.org,
coreteam@...filter.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next] netfilter: conntrack: Reduce cond_resched
frequency in gc_worker
lirongqing <lirongqing@...du.com> wrote:
> From: Li RongQing <lirongqing@...du.com>
>
> The current implementation calls cond_resched() in every iteration
> of the garbage collection loop. This creates some overhead when
> processing large conntrack tables with billions of entries,
> as each cond_resched() invocation involves scheduler operations.
>
> To reduce this overhead, implement a time-based throttling mechanism
> that calls cond_resched() at most once per millisecond. This maintains
> system responsiveness while minimizing scheduler contention.
>
> gc_worker() with hashsize=10000 shows measurable improvement:
>
> Before: 7114.274us
> After: 5993.518us (15.8% reduction)
I dislike this, I have never seen this pattern.
Whole point of cond_resched() is to let scheduler decide.
Maybe it would be better to move gc_worker off to its own
work queue (create_workqueue()) instead of reusing system wq
so one can tune the priority instead?
Powered by blists - more mailing lists