netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Judy Hsiao <judyhsiao@chromium.org>
Cc: Eric Dumazet <edumazet@google.com>,
	David Ahern <dsahern@kernel.org>, Simon Horman <horms@kernel.org>,
	Douglas Anderson <dianders@chromium.org>,
	Brian Haley <haleyb.dev@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Joel Granados <joel.granados@gmail.com>,
	Julian Anastasov <ja@ssi.bg>, Leon Romanovsky <leon@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH v2] neighbour: Don't let neigh_forced_gc() disable preemption for long
Date: Wed, 6 Dec 2023 09:39:17 -0800	[thread overview]
Message-ID: <20231206093917.04fd57b5@hermes.local> (raw)
In-Reply-To: <20231206033913.1290566-1-judyhsiao@chromium.org>

On Wed,  6 Dec 2023 03:38:33 +0000
Judy Hsiao <judyhsiao@chromium.org> wrote:

> diff --git a/net/core/neighbour.c b/net/core/neighbour.c
> index df81c1f0a570..552719c3bbc3 100644
> --- a/net/core/neighbour.c
> +++ b/net/core/neighbour.c
> @@ -253,9 +253,11 @@ static int neigh_forced_gc(struct neigh_table *tbl)
>  {
>  	int max_clean = atomic_read(&tbl->gc_entries) -
>  			READ_ONCE(tbl->gc_thresh2);
> +	u64 tmax = ktime_get_ns() + NSEC_PER_MSEC;
>  	unsigned long tref = jiffies - 5 * HZ;
>  	struct neighbour *n, *tmp;
>  	int shrunk = 0;
> +	int loop = 0;
>  
>  	NEIGH_CACHE_STAT_INC(tbl, forced_gc_runs);
>  
> @@ -278,11 +280,16 @@ static int neigh_forced_gc(struct neigh_table *tbl)
>  				shrunk++;
>  			if (shrunk >= max_clean)
>  				break;
> +			if (++loop == 16) {

Overall looks good.
Minor comments:
	- loop count should probably be unsigned
        - the magic constant 16 should be a sysctl tuneable

  parent reply	other threads:[~2023-12-06 17:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-06  3:38 [PATCH v2] neighbour: Don't let neigh_forced_gc() disable preemption for long Judy Hsiao
2023-12-06  3:43 ` David Ahern
2023-12-06  7:34 ` Eric Dumazet
2023-12-06 17:21 ` Doug Anderson
2023-12-06 17:39 ` Stephen Hemminger [this message]
2023-12-06 17:51   ` David Ahern
2023-12-06 18:49     ` Doug Anderson
2023-12-06 19:15       ` David Ahern
2023-12-08 10:50 ` patchwork-bot+netdevbpf

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=20231206093917.04fd57b5@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=davem@davemloft.net \
    --cc=dianders@chromium.org \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=haleyb.dev@gmail.com \
    --cc=horms@kernel.org \
    --cc=ja@ssi.bg \
    --cc=joel.granados@gmail.com \
    --cc=judyhsiao@chromium.org \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).