public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Li,Rongqing" <lirongqing@baidu.com>
To: Florian Westphal <fw@strlen.de>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
	Jozsef Kadlecsik <kadlec@netfilter.org>,
	Phil Sutter <phil@nwl.cc>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	"netfilter-devel@vger.kernel.org"
	<netfilter-devel@vger.kernel.org>,
	"coreteam@netfilter.org" <coreteam@netfilter.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [????] Re: [PATCH net-next] netfilter: conntrack: Reduce cond_resched frequency in gc_worker
Date: Wed, 15 Oct 2025 01:56:35 +0000	[thread overview]
Message-ID: <13de94827815469193e10d6fb0c0d45b@baidu.com> (raw)
In-Reply-To: <aO5K4mICGHVNlkHJ@strlen.de>

> > 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.
> 

This patch is similar as 

commit 271557de7cbfdecb08e89ae1ca74647ceb57224f
    xfs: reduce the rate of cond_resched calls inside scrub

> 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?

I am fine to move gc_worker to its own work queue

Thanks

-Li

  reply	other threads:[~2025-10-15  1:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-14 11:51 [PATCH net-next] netfilter: conntrack: Reduce cond_resched frequency in gc_worker lirongqing
2025-10-14 13:06 ` Florian Westphal
2025-10-15  1:56   ` Li,Rongqing [this message]
2025-10-15 11:06     ` Florian Westphal
2025-10-15 11:49       ` Peter Zijlstra

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=13de94827815469193e10d6fb0c0d45b@baidu.com \
    --to=lirongqing@baidu.com \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=horms@kernel.org \
    --cc=kadlec@netfilter.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.org \
    --cc=phil@nwl.cc \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox